Printing Problems

How to Print Excel Order Forms with Duplex Printing Using VBA

John WilsonJohn Wilson Nov 10, 2026 871 views

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).

How to Print Excel Order Forms with Duplex Printing Using VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Access Windows printer settings

Navigate to Windows Settings > Devices > Printers & scanners, select your target printer, and click 'Manage' followed by 'Printing preferences'.

2
Enable duplex printing

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'.

3
Open the VBA Editor

In Excel, press ALT + F11 to open the Visual Basic for Applications Editor, and insert a new Module from the Insert menu.

4
Insert the macro code

Paste your print loop macro (e.g., a For loop that updates Range("D45").Value and calls ActiveSheet.PrintOut Copies:=1, Collate:=True).

5
Set print area and run

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.

Configure Windows Printer Preferences and Run the VBA PrintOut Macro
Printer Compatibility: The exact VBA method for forcing duplex mode without altering Windows settings depends heavily on specific third-party printer drivers and API calls, which can be complex and unreliable across different machines.
Automate Printing with WPS Spreadsheet

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. 1. Open your order form: Launch WPS Spreadsheet and open your .xlsm order form file.
  2. 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. 3. Configure duplex settings: Go to Menu > Print, select your printer, click 'Properties', and enable the two-sided printing option.
  4. 4. Run your print macro: Execute your VBA macro to automatically generate sequential order numbers and send the duplex forms directly to the printer.
Highly compatible with Microsoft Excel (.xlsm, .xlsx) VBA macros and scripts.Advanced print preview and layout management for easy duplex configuration.Lightweight, fast-loading, and completely free to use.Familiar interface ensures a seamless transition for automating daily tasks.
microsoft office alternative - wps office

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.