How do I simulate a parallel (LPT) Printer with a USB Printer?

Solution 1:

You can trick Windows by using the USB printer as a dummy "network" printer connected to LPT1.

Share the USB printer

Use a share-name easy to remember, such as "Printer".

Connect the shared printer as LPT1

NET USE LPT1: \\[Computer-Name]\Printer /PERSISTENT:YES

Solution 2:

Using a USB to parallel adapter doesn't make any sense. Here we are speaking about using a very old legacy software on hardware with USB only connections. In my case, a ZEBRA label printer.

The solution in my case was.

  1. Install the USB printer with its drivers (just to find on which USB port is connected)
  2. Change the driver's port to FILE (and free up the USB port)
  3. Install a Generic / Text Only driver and change the port to the same logical USB port as seen on point 1
  4. Share the Generic /Text Only printer in order to make it visible easily in VBA
  5. Install the Microsoft Loopback adapter on a fixed unused IP address (otherwise your printer will be not visible when the cable is disconnected)
  6. Assign a LPTx: port as explained before by command line (this is for every SW that needs an old LPT)

With few rows of code you will be able to send ASCII codes to the printer as used in the past.

Now you can easily print in VBA (tested with Windows 7 64-bit and ZM400 Zebra printer)

Open "\\Kb\ZM400" For Output As #1       'Kb = computer Name; ZM400 = Shared printer name
For rows = 1 To 37 ' send the first 37 rows of ASCII codes from the worksheet "STRINGS"
    Print #1, Worksheets("STRINGS").Cells(rows, 1).Value
Next
Close #1