How to Make an Excel Print Macro Use the Default Printer
Question details
The user wants an Excel macro used for printing daily reports to automatically use the computer's default printer instead of a specific printer.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Running a recorded macro to print daily reports and sharing the macro with coworkers.
- Observed behavior
- The recorded macro only works with the specific printer selected during recording because it contains hardcoded printer settings and unnecessary PrintCommunication commands.
Before modifying your macro's VBA code, ensure you have saved a backup copy of your workbook (.xlsm) to prevent any accidental loss of functionality.
Edit the VBA Code to Remove Hardcoded Printer References
By deleting specific printer names and unnecessary communication statements from the VBA editor, the macro will automatically default to the active system printer.
When you record a print macro, Excel captures the exact printer active at that moment. To make it universal, you must manually remove these constraints in the Visual Basic for Applications (VBA) editor.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications editor in Excel.
In the left panel, expand the 'Modules' folder and double-click the module containing your recorded print macro.
Look for any line of code that says 'Application.ActivePrinter = "[Your Printer Name]"' and delete it completely.
Delete lines containing 'Application.PrintCommunication = False' or 'True' if they are unnecessary. Keep only essential 'PageSetup' properties required for your layout, such as '.Orientation' and '.Zoom'.
Save your macro (CTRL + S), close the VBA editor, and run the macro to verify it successfully sends the document to your default Windows printer.

Execute and Edit Print Macros in WPS Spreadsheet
WPS Office offers robust spreadsheet capabilities, including seamless support for editing and running VBA macros, allowing you to automate your printing tasks without hassle.
- 1. Open Your Macro File: Launch WPS Spreadsheet and open your .xlsm file containing the print macro.
- 2. Access the Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' to access your macro code.
- 3. Modify the Code: Remove any specific printer references just as you would in Excel, ensuring the macro relies on the default printer.
- 4. Run Your Automated Print: Save your file, close the editor, and click 'Macros' > 'Run' to seamlessly print your daily reports.

Frequently Asked Questions
Why does my recorded Excel macro force a specific printer?
When you use the macro recorder, Excel captures your exact actions, including the specific printer that is active at the time. It explicitly writes this into the VBA code using the Application.ActivePrinter property, overriding default settings on other computers.
What is PrintCommunication in Excel VBA?
Application.PrintCommunication is a property used to speed up the execution of code that modifies PageSetup properties. However, recorded macros often generate unnecessary PrintCommunication commands that can cause errors or printer conflicts when moving the macro to a different environment.
Will removing page setup details ruin my print formatting?
No, you only need to remove the lines referencing the printer name and the PrintCommunication commands. You should retain essential PageSetup properties like .Orientation (landscape/portrait), margins, or .FitToPagesWide to ensure your layout remains intact.
Can I set a specific default printer using a macro without hardcoding the port?
It is difficult because Excel requires the exact printer name and port (e.g., 'PrinterName on Ne01:'). The most reliable method for sharing macros is to let the user's operating system handle the default printer by removing the Application.ActivePrinter line entirely.




