How to Print Excel Order Forms with Duplex Printing Using VBA
Question details
The user needs to automate the printing of Excel order forms using a VBA macro that updates sequential order numbers while ensuring the forms print on both sides of the paper (duplex printing).

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Running a VBA loop to generate sequential order numbers on a two-page form and automatically sending them to a printer to be printed double-sided.
- Observed behavior
- The standard VBA PrintOut method does not include a universal duplex parameter, meaning two-sided printing must be handled by the printer driver or OS settings rather than directly through Excel VBA code.
Verify that your physical printer supports automatic two-sided (duplex) printing and ensure that the correct paper size is loaded in the primary tray before running any automated print macros.
Configure Windows Printer Preferences and Run the VBA PrintOut Macro
Because Excel's PrintOut method lacks a built-in duplex parameter, configuring your printer's default settings in Windows is the most reliable way to enforce two-sided printing during a VBA loop.
Duplex printing is a hardware-level instruction controlled by the printer driver, not the application software. By setting the default preference at the system level, Excel will automatically send the print jobs as two-sided documents.
Navigate to Windows Settings > Devices > Printers & scanners, select your target printer, and click 'Manage' followed by 'Printing preferences'.
Locate the 'Two-sided' or 'Duplex' printing option in the preferences dialog and set it to 'Print on both sides' (choose long edge or short edge depending on your form's layout), then click 'OK'.
In Excel, press ALT + F11 to open the Visual Basic for Applications Editor, and insert a new Module from the Insert menu.
Paste your print loop macro (e.g., a For loop that updates Range("D45").Value and calls ActiveSheet.PrintOut Copies:=1, Collate:=True).
Ensure your Excel print area encompasses both pages of the order form so they are processed as a single print job, then execute the macro.

Prepare Page Layout and Headers via VBA for Duplex Printing
Use VBA to ensure the print area, collate settings, and dynamic headers are perfectly aligned for a two-page order form before sending the job to a duplex-enabled printer.
Use WPS Spreadsheet to Automate and Print Order Forms
WPS Spreadsheet provides excellent support for VBA macros, allowing you to seamlessly automate order number generation and batch printing. Its intuitive page layout management makes configuring duplex print jobs straightforward.
- 1. Open your order form: Launch WPS Spreadsheet and open your .xlsm order form file.
- 2. Access the VBA Editor: Navigate to the 'Tools' or 'Developer' tab and click on 'Macros' to access the Visual Basic Editor, where you can paste your printing loop.
- 3. Configure duplex settings: Go to Menu > Print, select your printer, click 'Properties', and enable the two-sided printing option.
- 4. Run your print macro: Execute your VBA macro to automatically generate sequential order numbers and send the duplex forms directly to the printer.

Frequently Asked Questions
Why doesn't the VBA PrintOut command have a duplex argument?
Duplex printing is a hardware-specific feature managed by the printer driver, not the application software. Therefore, spreadsheet programs rely on the default settings configured in the operating system's printer properties to determine whether to print on one or both sides.
Can I use SendKeys in VBA to toggle duplex printing?
While it is technically possible to use SendKeys to simulate keyboard strokes to navigate the Print dialog and toggle settings, it is highly discouraged. It is unreliable and can easily cause errors if the printer dialog UI or system focus changes during macro execution.
How do I ensure my two pages print on the same sheet of paper?
You must define the Print Area to include both pages simultaneously and ensure there are no manual page breaks that split the document into separate print jobs. Sending them as a single continuous print job to a duplex-configured printer ensures they will print back-to-back.




