PDA

View Full Version : Print excel sheet to a PDF file



xander1981
12-13-2012, 07:15 PM
Hello Excel guys, I feel stupid again.

Ive been trying to get my excel sheet to print to my desktop as PDF as we have a PDF writer as a printer. I have the following code which is terrible im sure but hope you will get my gist. Any ideas?



Sub print2pdf()

Application.ActivePrinter = "PDF Writer on Ne02:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"PDF Writer on Ne02:", Collate:=True, PrToFileName:="C:\Documents and Settings\aljacobs\Desktop\Filename.pdf"

End Sub

the file does get created to my desktop but it wont open :(

Admin
12-13-2012, 10:07 PM
You mean like


ActiveWindow.SelectedSheets.PrintOut Copies:=1, preview:=True, ActivePrinter:= _
"PDF Writer on Ne02:", Collate:=True, PrToFileName:="C:\Documents and Settings\aljacobs\Desktop\Filename.pdf"

xander1981
12-14-2012, 02:16 PM
Thanks Admin but same results as my code. File is written to my desktop but it wont open. :(