Change the default printer using VBA in Microsoft Excel





This example macro shows how to print a selected document to another printer then the default printer.
This is done by changing the property Application.ActivePrinter :

Sub PrintToAnotherPrinter()
Dim STDprinter As String
    STDprinter = Application.ActivePrinter
    Application.ActivePrinter = "microsoft fax on fax:" 
    ' change printer
    ActiveSheet.PrintOut 
    ' prints the active sheet
    Application.ActivePrinter = STDprinter 
    ' change back to standard printer
End Sub

 



3 thoughts on “Change the default printer using VBA in Microsoft Excel

  1. “I want to select which printer from a list of the printers attached to the PC.

    Can do in VB, but cannot see how to do in VBA for Excel
    (Preferably 2000)”

  2. “I want to select which printer from a list of the printers attached to the PC.

    Can do in VB, but cannot see how to do in VBA for Excel
    (Preferably 2000)”

Leave a Reply

Your email address will not be published. Required fields are marked *


5 − five =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>