Results 1 to 6 of 6

Thread: Print to non-default printer

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    I have a label-printing program that I want to print to a non-default printer. Each label is printed using "PrintForm". I do not want my user to have to change the setting for the default printer each time she needs to print a label.

    What is the simplest way to change the printer in code?

    Thanks in advance.

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    You can enumarate the printers collection until you find the correct printer. Then you set the printer object to that printer.

    Code:
    Dim myPrinter As Printer
    
    For Each myPrinter In Printers
      If myPrinter.DeviceName = "the name of the device you want" Then
        Set Printer = myPrinter
      End If
    Next
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    This looks promising - I'll give it a try

    Thanks Iain (with an i!)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    Yep - It worked perfectly and my labels user is now delighted that she doesn't have to keep switching the default printer.

    You have helped me win 1 million brownie points!!!

  5. #5
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    The pleasure was all mine.
    Iain, thats with an i by the way!

  6. #6
    Junior Member
    Join Date
    Jul 2000
    Location
    Antwerp,Belgium
    Posts
    21

    Thumbs up Printer

    Thanks,

    I just used that bit of code. Works great.

    Keep up the good work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width