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

  • Thread starter Thread starter johan
  • Start date Start date
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
 
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.
 
Back
Top