• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

Printing to another port

I  have 2 printers attached to my machine, (LPT1: and LPT2:). How do I print to LPT2? I do not want to use Open# and Print# statements.
0
dmoore2
Asked:
dmoore2
1 Solution
 
Erick37Commented:
Loop thru the Printers collection until you find a printer that meets your requirements:

e.g.

Dim p As Printer
For Each p In Printers
    If (p.Port = "LPT2:") And (p.DeviceName Like "*LaserJet*") Then
        ' Set printer as system default.
        Set Printer = p
        Debug.Print Printer.DeviceName
        ' Stop looking for a printer.
        Exit For
    End If
Next
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now