How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask John D Your Own Question
John D
John D, Bachelor of Science - Engineering Consultant
Category: Programming
Satisfied Customers: 9666
Experience:  Vast experience in Excel programming and business solutions
Type Your Programming Question Here...
John D is online now
A new question is answered every 9 seconds

How can I get an excel 2010 macro to select alternative printers

Customer Question

How can I get an excel 2010 macro to select alternative printers? From what I can see it will only print to default printer.
Submitted: 6 years ago.
Category: Programming
Expert:  John D replied 6 years ago.



Here is the code for selecting a printer


Application.ActivePrinter = "XYZ"


Where XYZ is your printers name


Now to find the exact printer that the code should use, record a new macro, then go to the Print command. When the Print dialog box opens, select the printer that you want to use, and click OK. Now stop the macro and go to the recorded code and you will see the full name of the printer. That is the exact name that you should use in your code.


Hope this is helps. Let me know if you have any questions, and thank you for clicking Accept if you are satisfied with the answer







Customer: replied 6 years ago.

Hello JohnD,


This method works with Office 2007 and earlier versions, in fact I have been using it for years, but I haven't been able to make it work with 2010 version.

Expert:  John D replied 6 years ago.

hmm.. It should also work in 2010.


Could you record a new macro in Excel 2010 and change the printer when the recording is on, then stop the recording and copy the code and paste it here. I want to see the exact printers name


Customer: replied 6 years ago.

Hi John,


When you record it in a macro it makes the changes between printers that you select but it doesn't record the printer details in the macro so the next time you run the macro it just prints to the currently elected printer.


I have worked out a solution .... what you have to do is enter the following:

MsgBox "The name of the active printer is " & _


This will give you the description of the currently elected printer and then you can enter it into the Application.ActivePrinter =" "


Thanks anyway.


Expert:  John D replied 6 years ago.

Yes that is the correct way to do it. Good job.


Thanks for sharing