I have written a macro to print to a specific printer on the network. I started by using the macro recorder to see what Excel liked for the printer name, and then added code as necessary. It is a very simple macro that defines a print range, then prints to the specified printer as follows:
This macro has worked just fine for several months, but recently it started printing to my local printer (which is also set as my default printer) for no apparent reason; and I can't get it to change back to the network printer. I have verified the following:
- the network name of the device has not changed
- I still have access to it from my PC (I still see it in my Printers folder)
- The printer is physically working just fine
- I can print to it manually from my PC
I have even re-recorded the macro and the code is exactly the same as it was before (minus the code I added). Has anyone else had this problem? If so, what was your solution? Is there a better (i.e. more reliable) method of printing to a network printer (or any printer other than your default)?
Many thanks in advance for any advice or assistance anyone might be able to offer.
Code:
Sub PrintInvoices()
Dim strPrintArea As String
strPrintArea = Range("rngPrint").Value
Worksheets("Report").PageSetup.PrintArea = strPrintArea
Worksheets("Report").PrintOut Copies:=1, Collate:=True, ActivePrinter:= _
"Auto HP LaserJet 4000 Series PCL 6 on PAT on Ne14:", Collate:=True
End Sub
This macro has worked just fine for several months, but recently it started printing to my local printer (which is also set as my default printer) for no apparent reason; and I can't get it to change back to the network printer. I have verified the following:
- the network name of the device has not changed
- I still have access to it from my PC (I still see it in my Printers folder)
- The printer is physically working just fine
- I can print to it manually from my PC
I have even re-recorded the macro and the code is exactly the same as it was before (minus the code I added). Has anyone else had this problem? If so, what was your solution? Is there a better (i.e. more reliable) method of printing to a network printer (or any printer other than your default)?
Many thanks in advance for any advice or assistance anyone might be able to offer.