MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Run time error.

Posted by Bob T on August 29, 2001 5:50 AM

I would like my macro to select a specific printer from the network. 90% of the users are able to use this macro just fine. However, the other 10% of the users receive a “run time error ‘1004’” (Method ‘Active printer’ of object’_ Application failed) message.
The start of my macro reads:
Application.Goto Reference:="PraLetter"
Application.ActivePrinter = "\\usps002\PRT188 on Ne01:"
Selection.PrintOut Copies:=1, Collate:=True

Do you have any suggestions? Is it a network or Window 2000 issue or can you help me on the code. I cannot have this printer as the default printer. However, if this file could be set up to print to that specific printer would be another solution. Is there a way to do this instead? I would really appreciate your help.

Posted by Damon Ostrander on August 30, 2001 9:21 AM

Hi Bob,

This is only a guess, but I'm wondering if the 10% of the machines the macro does not work on do not have this printer set up. I believe that the ActivePrinter property simply determines which printer will be the default printer, but it must be one of the printers that are already set up on the computer.

If this is the case, my suggestion would be to set up an error handler that traps this error, prints a message to the screen with MsgBox asking the user to set up the printer, then clicking Ok when the setup is complete and your code then sets the activeprinter and continues.


Posted by Bob Thuli on August 30, 2001 2:31 PM

Damon: Thanks for your suggestions. Unfortunately that is not the issue. I have that printer set up on all PC's that use this file. Very often rebooting the PC takes care of the problem other times it does not. It seems to be a random thing.

Hi Bob,

Posted by Bob T on August 30, 2001 2:35 PM

Hi Damon;

Thanks for your suggestion. However, that is not the case. I have this printer set up on all PC's that use this file. Sometimes rebooting the PC takes care of the problem, but other times not. It seems to be a random thing.