How to Create a PDF and Print an Excel Workbook Simultaneously
Question details
The user wants to find a way to automatically export an Excel workbook as a PDF file and send it to a physical printer at the exact same time.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Preparing finalized reports or documents that need to be both archived digitally as PDFs and distributed as physical hard copies, without performing duplicate manual actions.
- Observed behavior
- Excel does not offer a single built-in command or button that performs both the PDF export and the print action simultaneously.
Ensure you have the Developer tab enabled in your Excel ribbon to access the VBA Editor, and check that your default printer is online and properly configured.
Use an Excel VBA Macro to Automate PDF Creation and Printing
Since Excel lacks a native single-click feature for this, you can write a short Visual Basic for Applications (VBA) script to sequentially perform both actions in one go.
Combining PDF creation and automatic printing requires VBA code. By combining the 'ExportAsFixedFormat' method for PDFs and the 'PrintOut' method for printing, you can execute both tasks seamlessly.
You can link this macro to a custom button in your worksheet so that future reports can be saved and printed with a single click.
Go to File > Options > Customize Ribbon. In the right pane, check the box next to 'Developer' and click OK.
Navigate to the Developer tab on the ribbon and click 'Visual Basic', or simply press ALT + F11 on your keyboard.
In the VBA editor, right-click on your workbook name in the Project Explorer panel on the left, select 'Insert', and then click 'Module'.
Paste a combined VBA script into the module window. You will need code that uses 'ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF' followed by 'ActiveSheet.PrintOut'. If you do not know how to write this, you can easily find complete snippet templates on forums like Stack Overflow.
Go back to your Excel sheet. On the Developer tab, click 'Insert', select a 'Button (Form Control)', draw it on your sheet, and assign your newly created macro to it.

Run Macros and Export to PDF Seamlessly with WPS Spreadsheet
WPS Spreadsheet provides excellent compatibility with Microsoft Excel VBA macros. You can run your automation scripts to simultaneously print and save to PDF, or utilize its built-in, user-friendly PDF export tools to manage your workflow.
- 1. Open your Document in WPS: Launch WPS Spreadsheet and open your existing Excel workbook.
- 2. Access the Developer Tools: Navigate to the 'Tools' or 'Developer' tab on the top ribbon.
- 3. Open the VBA Editor: Click on 'Macros' or 'Visual Basic' to access the scripting environment and paste your combined PDF and Print code.
- 4. Execute the Macro: Run the macro directly or assign it to a graphical button in your WPS sheet for one-click automation.

Frequently Asked Questions
Do I need advanced programming skills to create this VBA macro?
No. While basic understanding helps, you do not need to be a programmer. You can search Excel forums for terms like 'VBA save as PDF and print' and copy the step-by-step code templates directly into your VBA editor.
Why doesn't Excel have a built-in button for exporting and printing together?
Excel treats saving a file (exporting) and sending data to a hardware device (printing) as two distinct background processes. Keeping them separate maintains a standardized interface for general users who rarely need to do both simultaneously.
Can I assign my new PDF and Print macro to a keyboard shortcut instead of a button?
Yes. In the Developer tab, click 'Macros', select your created macro from the list, click 'Options', and assign it a custom keyboard shortcut (such as Ctrl+Shift+P) for rapid access.




