How to Customize the Word VBA Printer Selection Dialog
Question details
The user wants to customize the built-in Word VBA printer setup dialog by adding custom buttons or controls, and needs a way to prevent the macro from printing if the user clicks Cancel.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Writing a VBA macro to manage printer selection, configure printer settings, and execute print jobs safely.
- Observed behavior
- The built-in Application.Dialogs(wdDialogFilePrintSetup).Show dialog is fixed and does not allow the addition of custom Configure, OK, or Cancel buttons.
Ensure you have basic familiarity with VBA (Visual Basic for Applications) and have enabled the Developer tab in your Word application.
Create a Custom UserForm to Replace the Built-In Dialog
Since the built-in printer dialog cannot be directly modified, you must design a custom UserForm that simulates the printer selection process and includes your desired buttons.
Creating a custom UserForm is the only way to fully control the user interface for printer selection. This allows you to add specific 'Configure', 'OK', and 'Cancel' buttons tailored to your macro's workflow.
Press Alt + F11 to open the Visual Basic for Applications editor, then go to Insert > UserForm to create a new blank form.
Use the Toolbox to add a ComboBox for listing available printers, and insert CommandButtons for your 'OK' and 'Cancel' actions.
Write VBA code in the UserForm_Initialize event to detect available system printers and populate the ComboBox.
Double-click your custom buttons to write the execution code. Ensure your 'OK' button triggers the PrintOut command and your 'Cancel' button simply closes the form using Unload Me.

Capture the Dialog Result to Prevent Unwanted Printing
If you continue using the built-in dialog, you must check its return value to ensure the macro doesn't print when the user clicks Cancel.
Looking for a Better Way to Manage Documents? Try WPS Office
If you are frustrated by the rigid limitations of Microsoft Word's built-in dialogs, consider switching to WPS Office. It is a highly compatible, free, and lightweight suite that handles standard Word formats perfectly while offering a familiar interface for all your document and printing needs.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install the Suite: Run the installer and follow the on-screen prompts to set up WPS Office on your computer.
- 3. Open Your Documents: Launch WPS Writer and open your existing Word documents to experience seamless formatting and printing.

Frequently Asked Questions
Can I add a custom button directly to Word's built-in printer dialog?
No, the built-in wdDialogFilePrintSetup dialog is fixed by the application and cannot be modified to include extra buttons like 'Configure' or custom 'Cancel' actions.
How do I stop my macro from printing if the user clicks Cancel?
You need to evaluate the return value of the dialog. If the dialog returns 0 (indicating Cancel), your macro should bypass the PrintOut command entirely using an If statement.
How can I control specific printer settings using VBA?
Because each printer model has unique properties, you cannot control them all via standard Word dialogs. You must either send specific commands to the printer driver or use a custom UserForm designed around that specific printer's capabilities.




