print to pdf with vba

J

J Wait

How do you print to pdf in VBA and tell it where to save the pdf file and
what to name the pdf file. I can save as pdf in vba, but this does not pdf
the file correctly (different tabs save as different sizes in pdf and it's a
mess). Only printing (not saving) to pdf does it correctly.

When I record myself, it records:
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
 
S

Stephan Kassanke

J said:
How do you print to pdf in VBA and tell it where to save the pdf file and
what to name the pdf file. I can save as pdf in vba, but this does not pdf
the file correctly (different tabs save as different sizes in pdf and it's a
mess). Only printing (not saving) to pdf does it correctly.

When I record myself, it records:
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"

I used pdfcreator a lot for generating (aka printing) PDFs from VBA.

http://sourceforge.net/projects/pdfcreator/

Samples are included as far as I know. Have a look at
http://www.dailydoseofexcel.com/archives/2006/05/12/excel-pdfcreator/
for further assistance.

Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top