PDA

View Full Version : Solved: Programatically Print



leeweaver
10-30-2008, 06:19 AM
I have a project I'm working on and would like to have a single click filter my worksheet, hide rows, set the print area and print the report. I have all of the above done except for print the report.

I need to be able to select the printer and print programatically.

Bob Phillips
10-30-2008, 06:24 AM
Activesheet.Printout


I avoid setting the printer programmatically, far better to let the user select, they are used to doing that.

leeweaver
10-30-2008, 06:40 AM
In this case I am the user. I need to generate a PDF report every week. and want to automate it. I want to automatically select the "PDF" printer.

leeweaver
10-30-2008, 06:49 AM
Thanks for the help. but I figured it out using the macro record function.

leeweaver
10-30-2008, 06:50 AM
Application.ActivePrinter = "Adobe PDF on Ne04:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne04:", Collate:=True

mdmackillop
10-30-2008, 12:38 PM
Always useful to return things as they were
tmp = Application.ActivePrinter
Application.ActivePrinter = "Adobe PDF on Ne04:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne04:", Collate:=True
Application.ActivePrinter = tmp