Application.Activeprinter fails because Ne00 port changes
Posted by Craig Lebakken on 17 June 2008 02:36 PM
I use the Visual Basic command Application.ActivePrinter = "Win2PDF on Ne00:" to set Win2PDF as the active printer, but when I try to use it on another computer Win2PDF is on "Ne02" so the assignment fails. Why does the "Ne00" port change, and how do I set Win2PDF as the active printer without knowing which "Ne00" port number?
The "Ne" port is assigned by Windows, and we don't have control over the assignment. It can vary depending on the other printers installed on the PC.
The following page has example VB code that should resolve the problem:
The code loops through all possible values for the "Nexx" port names until the active printer is set.