Home » excel » Excel – Creating a print macro

Excel – Creating a print macro

Posted by: admin April 23, 2020 Leave a comment

Questions:

I recorded a macro to print an excel sheet when the button is pressed. But I want to specify the printer that it automatically prints to rather than give the user a choice. I’m also printing to a PDF so is there a way I can choose where I print to?

This is what I have so far:

Sub Publish()
    '
    ' Publish Macro
    ' Macro recorded 07/09/2010
    '
    ' Keyboard Shortcut: Ctrl+Shift+S
    '
        ActiveWindow.SelectedSheets.PrintOut Copies:=1
    End Sub
How to&Answers:

Try adding

Application.ActivePrinter = "Printer Name"

on the line above the PrintOut command. This link gives more information on ActivePrinter, even though it is geared more for MS Word.