This tutorial will demonstrate how to save / print to a PDF in Excel VBA. This simple procedure will print the ActiveSheet to a PDF. Sub SimplePrintToPDF ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:='demo.pdf', Quality:=xlQualityStandardIncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=True End Sub. Printer – includes all the available printers you can use, including the options to print to a PDF file or send the web page to OneNote. Copies – allows you to configure the number of copies.
This article applies only to novaPDF. If you don't have it yet, you must download it first.
novaPDF (all editions)
Microsoft Excel 2016/2013/2010/2007/2003
We strive to keep our articles as accurate as possible. If you notice any inconsistencies or outdated info please let us know.
If you print to novaPDF the Entire Workbook multiple individual sheets of your Excel workbook, when you try to create a PDF and choose to print the Entire Workbook, each sheet will be saved as a different PDF file. This happens because one (or multiple) sheets in your workbook have a different dpi setting for printing. Because of this, Excel assumes that each individual sheet has to be sent for printing separately, so it will send it in the same way to the PDF printer which will prompt to create a PDF from each sheet.
If you have multiple individual sheets within your Excel workbook, when you try to create a PDF and choose to print the Entire Workbook, each sheet will be saved as a different PDF file. This happens because one (or multiple) sheets in your workbook have a different dpi setting for printing. Because of this, Excel assumes that each individual sheet has to be sent for printing separately, so it will send it in the same way to the PDF printer which will prompt to create a PDF from each sheet.
In order to have all the individual sheets printed within a single PDF file (not multiple PDFs) you need to set the same DPI printing value for all of them.
In order to set the DPI value for each individual page, you have to follow these steps:
- Open the Excel workbook
- Select the sheet you want to set the DPI for
- In Microsoft Excel 2016/2013/2010/2007 go to Page Layout and click on the expand button for the Page Setup dialog (for Microsoft Excel 2003 or earlier go to File->Page Setup)
- In the Print Quality section enter the DPI value that you want to have for your document (note that this is the DPI value you will have to set for each individual sheet too) and press OK
- novaPDF will ask you where to save the PDF and (if set so) it will open the PDF when it's created. You will have to repeat these steps for each individual sheet in your workbook.
The above method is recommended when you have different printing settings for each page (for instance if you have a Header/Footer set for each page). However, if you have the same printing settings for each sheet in the workbook, you can change the Page Setup options for all sheets at once. Please note that by using this method you will have the same settings for all sheets, including the header/footer.
To set the same Page Setup options for all individual Excel sheets:
- Open the Excel workbook
- Right-click the tab for any of the sheets you have in your workspace (by default they sheet tabs are named Sheet1, Sheet2, ...)
- Choose the Select all Sheets option (which will select all the sheets in your workspace, you can tell they're selected if all the sheet tabs have a white background like an active sheet tab would have)
- In Microsoft Excel 2016/2013/2010/2007 go to Page Layout and click on the expand button for the Page Setup dialog (for Microsoft Excel 2003 or earlier go to File->Page Setup). Set the Print Quality to the DPI value you want and press OK so that Excel will record the fact that all pages have the same print settings. It's important to press the OK button even if you don't change anything, because this will 'tell' Excel that all the sheets have the same page setup options.
- Click on File then Print and see if you like the way the pages will show when printed to PDF. If you don't have any changes to the printing options select the Print Entire Workbook option under Settings and novaPDF from the Printer name section and click Print to create the PDF file.
- novaPDF will ask you where to save the PDF and (if set so) it will open the PDF when it's created.
Video Tutorial:
novaPDF includes a PDF merging (combining) option, so another way to have multiple individual Excel sheets printed to a single PDF would be to use novaPDF's own merge option. This will let you print the first sheet to a PDF document and after that print all the other sheets in that workbook to the same pdf.
You can read more about the PDF merging option here: Merge PDF files with novaPDF