views:

22

answers:

1

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
+2  A: 

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.

JohnK813
Awesome, that works. Is there a way to specify the location as well?
BioXhazard
What do you mean by location? The name of the PDF file that you want to create?
JohnK813