Printer selection in Excel macro


I have an Excel file (2007), in which I print sheets via 2 network printers.
  • I've written a macro to select thename printers, it works in my PC, but not necessarily for another one.
  • I want all users to have access to the printer of their choice via a macro, is it possible?


Try this:

Sub test() 
Dim DefaultPrinter As String, Imprimante1 As String, Imprimante2 As String 
'Stocke le nom de l'imprimante par défaut, pour la remettre en fin de module 
DefaultPrinter = Application.ActivePrinter 
'Printer #1 choice
Imprimante1 = Application.ActivePrinter 
'Printer #2 choice 
Imprimante2 = Application.ActivePrinter 
'Show names stored in variables 
MsgBox Printer1 
MsgBox Printer2 
'Reset default printer : 
Application.ActivePrinter = DefaultPrinter
End Sub

Thanks to pikaju for this tip.


Published by aakai1056. Latest update on November 8, 2012 at 04:04 PM by Jeff.
This document, titled "Printer selection in Excel macro," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
VBA - Cut an instruction line in a macro
Excel - The DEGREES function