Printer selection in Excel macro

December 2016


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.

Related :

This document entitled « Printer selection in Excel macro » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.