Help with Printing Macro

pdkolmo

New Member
Joined
Jun 26, 2006
Messages
2
I am trying to create a macro that will create pdf files. To do this manually, I go to the File-> Print menu, and in the select printers box, I change it from the default printer to the Adobe PDF file option. I need to build a macro that will automatically send/print the worksheet to a pdf file and ideally one that will also automatically provide a name for the pdf file when prompted. Can anyone help?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Here's some code I used once. I had my filename in a range called CurrStore on workhsheet Settings, but if you already know your filename, you can probably just hardkey it with quotes or perhaps call a variable where you have the filename stored.


Sub PrinttoPDF()
Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"""
ActiveWindow.SelectedSheets.PrintOut PrinttoFile:=True, _
Prtofilename:=Worksheets("Settings").Range("CurrStore").Value
End Sub

I hope this helps.
 
Upvote 0

Forum statistics

Threads
1,215,348
Messages
6,124,423
Members
449,157
Latest member
mytux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top