VBA & Macro Problems

Fix Excel VBA Not Recording Worksheet Print Commands

Algirdas JasaitisAlgirdas Jasaitis Nov 22, 2026 868 views

Question details

The user needs a way to include worksheet printing in an Excel VBA macro when the macro recorder does not capture the print action.

Fix Excel VBA Not Recording Worksheet Print Commands
Product
Microsoft Excel
Device & OS
not provided
Scenario
Recording a macro that prints selected worksheets.
Observed behavior
The recorded macro may not include the print command.
Before you start

Make sure a printer is available and decide whether the macro should print selected sheets or the entire workbook. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if you need to keep the VBA code.

Solution 1Recommended

Add a PrintOut command to the VBA macro

Use VBA to print the selected worksheets or the entire workbook when the recorder omits the print action.

1
Open the VBA editor

In Excel, open the Developer tab and select Visual Basic. If the Developer tab is hidden, enable it in Excel's ribbon settings.

2
Edit the recorded macro

In the VBA editor, find the recorded macro in its module. Add ActiveWindow.SelectedSheets.PrintOut where you want the currently selected worksheets to print.

3
Choose a different print scope

To print specific worksheets instead, use Sheets(Array("Sheet1", "Sheet2")).PrintOut and replace the names with your sheet names. To print the entire active workbook, use ActiveWorkbook.PrintOut.

4
Save and run the macro

Save the workbook as an .xlsm file. Select the intended worksheet tabs, then use Developer > Macros to select and run the macro.

Add a PrintOut command to the VBA macro
Check the print scope: ActiveWindow.SelectedSheets.PrintOut uses the sheets selected when the macro runs, so confirm the selected tabs before printing. PrintOut sends the job to the active printer.
Free Microsoft Office alternative

Print spreadsheets with WPS Office

WPS Office is a free, lightweight alternative for opening and printing spreadsheets through a familiar interface. Its Microsoft Office format support helps you move existing files into WPS, though it does not fix Excel's macro recorder.

Print spreadsheets using familiar print controlsOpen and work with Microsoft Excel .xlsx filesMove existing Office documents into a familiar workspaceUse a free, lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why is the print command missing from my recorded Excel macro?

Excel's macro recorder may not capture a print action. Open Developer > Visual Basic and add a PrintOut command to the recorded macro manually.

How do I print only the currently selected worksheets with VBA?

Select the worksheet tabs you want to print, then run a macro containing ActiveWindow.SelectedSheets.PrintOut. The command uses the selected sheets at the time the macro runs.

How can I print the whole workbook instead?

Add ActiveWorkbook.PrintOut to the macro in the VBA editor. It prints the active workbook rather than limiting the job to selected sheets.

What file format should I use to keep the macro?

In Excel, choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm). Saving as .xlsx does not retain VBA macros.