Click to See Complete Forum and Search --> : Printing to a Network Printer
softshel
Aug 24th, 2007, 10:29 AM
I am working with excel VBA and need to print a form to a set network printer and not the defalt printer. Many people on our network use this excel form and the defalt printer can very but I want all the printing of this form to be at a set network printer. I am using this code to print now "ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True". Can some one help me?
davesexcel
Aug 25th, 2007, 09:54 AM
Try something like this,I got the code from recording the macro
Application.ActivePrinter = "\\Daves\Lexmark 810 Series on Ne10:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"\\Daves\Lexmark 810 Series on Ne10:", Collate:=True
softshel
Aug 27th, 2007, 09:19 AM
Ya that worked good. But is there a way to find out my printers exact name. I can get most all of it but that last part after the Ne? thing. Is there a convention I should under stand or thomthing?
denmark219
Mar 5th, 2009, 11:30 AM
Good luck. I have had no luck figuring out a way to automatically figure out the "NE" number of a printer. I think it's absurd that you have to have that number anyway.
My problem is I have multiple people across the network using these forms, and they all have different NE numbers for the same printers. The NE is assigned when the printer is installed. So if you go back, uninstall all of their printers, then reinstall them all in the same order you're fine. But if you delete one and reinstall it at some point, that persons printer NE numbers are all messed up.
Anybody able to help on this one out there?
Mark
Aerious
Oct 4th, 2011, 02:42 PM
I realize that this post is 2 years old, but also I just found it today and it solved my problem, so I will solve the problem they had...
This assumes it is printing to non-default printer.
oldprinter = Application.ActivePrinter
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne00:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne01:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne02:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne03:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne04:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne05:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne06:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne07:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne08:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne09:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne10:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne11:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne12:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne13:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne14:"
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne15:"
ActiveWindow.Selection.PrintOut Copies:=1
Application.ActivePrinter = oldprinter
In fact that is pretty darn ugly so I just got this to work too (use as you like)
oldprinter = Application.ActivePrinter
For i = 0 To 15
curNePrint = Format(i, "00")
On Error Resume Next
Application.ActivePrinter = "\\ServerName\ZDesigner S4M-203dpi ZPL on ne" & curNePrint & ":"
Next i
ActiveWindow.Selection.PrintOut Copies:=1
Application.ActivePrinter = oldprinter
Thanks :)
~Aerious
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.