Print as pdf and save as xls with filename from a datafield

J

johan

Hello,

Can somebody help me out with below 2 questions.

I like to have a macro which shows me a printpreview as pdf file
(acrobat) with the filename xxxx.pdf as registered in field A2.

I like to have a macro which shows me the save as xls-file screen
where the file name xxxx.xls is as registered in field A2.

regards and thanks,
Johan
 
Joined
Jun 21, 2010
Messages
1
Reaction score
0
Johan,

I did the same a few days ago in Excel 2007 and saved as macro gives:

ActiveWorkbook.Sheets("print1").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\temp\xxxx.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=True

Added this to command button on form and opens the preview as PDF.

My sheet "print1" contains a predefined print area.

I don't think this will work for versions before 2007.

Hope it helps.
 

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