logo
search
VBA & Macro Problems

How to Print an Excel VBA UserForm and Fix Cut-off Issues

Algirdas JasaitisAlgirdas Jasaitis Sep 28, 2026 870 views

Question details

The user wants to add a print preview and printer selection option for an Excel VBA UserForm before printing to ensure the form does not get cut off.

How to Print an Excel VBA UserForm without a Print Preview
Product
Microsoft Excel
Device & OS
not provided
Scenario
Developing an Excel VBA UserForm and trying to allow users to review the output layout and choose a printer before finalizing the print.
Observed behavior
VBA lacks a native print preview feature for UserForms, and direct printing sometimes results in the printout being partially cut off.
Before you start

Ensure your VBA UserForm is scaled appropriately to fit within standard paper sizes, as the built-in printing method captures the form exactly as it is sized on your screen.

Solution 1Recommended

Use the PrintForm Method in VBA

Since Excel VBA does not support a native print preview for UserForms, you can use the Me.PrintForm command within a button click event to print the form directly to the default printer.

The Me.PrintForm method sends a pixel-by-pixel image of the active UserForm to your system's default printer. It prints the form exactly as it is displayed to the user, though it excludes the form's title bar and borders. Note that it cannot natively trigger a print preview or printer selection dialog.

1
Access the VBA Editor

Open your Excel workbook, press Alt + F11 to open the VBA Editor, and double-click your UserForm in the Project Explorer.

2
Add a Command Button

From the Toolbox, insert a CommandButton onto your UserForm. This will act as your 'Print' button.

3
Insert the PrintForm Code

Double-click the new CommandButton to open its code module. Enter the code 'Me.PrintForm' inside the Private Sub CommandButton1_Click() event and before the End Sub.

4
Run and Print

Press F5 to run the UserForm. Click the CommandButton you created to send the form directly to your default printer.

Use the PrintForm Method in VBA
Printer Selection Limitations: To allow printer selection, users must change their default printer in Windows settings before running the form, as PrintForm always routes directly to the default printer without prompting.

Run and Print VBA UserForms Seamlessly with WPS Spreadsheet

WPS Spreadsheet offers robust support for VBA macros and UserForms, allowing you to create, run, and print automated forms just like you do in Microsoft Excel.

  1. 1. Open Your Macro Workbook: Download and install WPS Office. Open your .xlsm file in WPS Spreadsheet.
  2. 2. Access the VBA Environment: Navigate to the Developer tab and click Visual Basic to open the VBA editor.
  3. 3. Configure the Print Button: Double-click your UserForm, insert a Command Button, and add the Me.PrintForm code to its click event.
  4. 4. Print Your Form: Run the UserForm and click your print button to send the form directly to your default printer.
Full compatibility with Microsoft Excel VBA macros (.xlsm format)Execute Me.PrintForm commands directly from UserForms without syntax changesLightweight application with fast macro executionFamiliar developer interface for seamless transition
microsoft office alternative - wps office

Frequently Asked Questions

Why is my printed VBA UserForm getting cut off?

The PrintForm method captures the UserForm exactly as it appears on your screen based on your display resolution. If the form is larger than the printable area of your default paper size, it will get cut off. Try reducing the width and height of the UserForm in the VBA editor, or adjust your default printer's paper size settings.

Can I show a printer dialog before using PrintForm?

No, the PrintForm method does not natively support opening a printer selection dialog; it automatically sends the print job to the system's default printer. To change printers, you must change the default printer in Windows before running the form, or use complex Windows API calls within your VBA code.

Does the PrintForm method include the title bar of the UserForm?

No, the PrintForm method only captures and prints the client area (the main body) of the UserForm. It intentionally excludes the title bar, window controls (minimize/close buttons), and the external form borders.