Solved

Printing to another port

Posted on 2000-03-02
1
130 Views
Last Modified: 2010-08-05
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
Comment
Question by:dmoore2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Erick37 earned 50 total points
ID: 2578637
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question