Problem : method ‘activeprinter’ of object’_application’ failed
I’m trying to print to a network printer or a PDFprinter. Switching back to the network printer is when I get the method ‘activeprinter’ of object’_application’ failed error. It worked the day I created the macro but the next day it stopped working.
When you run the debugger with MS Visual Basics it gives this Application.ActivePrinter = “\\raleigh1\Savin MLP25n on Ne09:” as the line of error.
Sub PrintPaperLong()
‘
‘ PrintPaperLong Macro
Range(“B2:J122”).Select
ActiveSheet.PageSetup.PrintArea = “$B$2:$J$122”
Range(“B62”).Select
ActiveSheet.HPageBreaks(1).Delete
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
Application.ActivePrinter = “\\raleigh1\Savin MLP25n on Ne09:”
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
“\\raleigh1\Savin MLP25n on Ne09:”, Collate:=True
Solution: method ‘activeprinter’ of object’_application’ failed
It is probably because the port “Ne09” can and does change. Stop the macro and type in the following and look at the results in your immediate window: ?application.ActivePrinter
Is it the same as what you put in your code? If the “ne..” number is different, the solutions I have seen usually involve looping through all the numbers (Ne00-Ne16) until it does not error out and that is the Ne number that is good. This is a weakness in the excel object model in that you have to enter the specific port name. You can google this topic, but here is the first site I found that talks about it:
http://www.tek-tips.com/viewthread.cfm?qid=879030