Results 1 to 14 of 14

Thread: How to select from Multiple printers

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Location
    Bulawayo, Zimbabwe
    Posts
    576

    Re: How to select from Multiple printers

    Thanks Hack, Thanks Guys The first part now works and I have now established that the printer that I want to print to is #2

    But when I try this:

    Printer(2).Print ‘Hello’
    I get the same error message on the above line ‘Object does not support this property or method’

    I have tried Printers(2).Print ‘Hello’ but I still get the same error.
    What am I missing here?

  2. #2
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    Kerala, India
    Posts
    275

    Re: How to select from Multiple printers

    The above code I have got from

    http://www.freevbcode.com/ShowCode.A...#selectprinter

    I have not tried it myself.
    I am surprised that it does not seem to work.

  3. #3
    Hyperactive Member
    Join Date
    Jun 2007
    Location
    Kerala, India
    Posts
    275

    Re: How to select from Multiple printers

    The following seems to work.

    Code:
    Dim defprinter As Printer
    
    For i = 0 To Printers.Count - 1
    If Printers(i).DeviceName = Printer.DeviceName Then
    Set defprinter = Printers(i) 'The current default printer
    Exit For
    End If
    Next
    
    Set Printer = Printers(2) ' the new default printer
    Printer.Print "Hello"
    Printer.EndDoc
    Set Printer = Printers(i) ' Revert to the original default printer

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