Fix Word Run-Time Error 402 When Opening a UserForm
Question details
The user needs to resolve Word VBA run-time error 402 when displaying a UserForm.

- Product
- Microsoft Word VBA
- Device & OS
- not provided
- Scenario
- A document or template uses event procedures to display a modal UserForm.
- Observed behavior
- Word displays run-time error 402 when procedures attempt to open a form while a modal UserForm is still active.
Open the affected document or template in desktop Word and press Alt+F11 to inspect its VBA code. Ensure the file is in a macro-enabled format, such as .docm or .dotm, and enable macros only if you trust the file.
Remove Redundant UserForm Launches from Word Events
Use this approach when more than one event or procedure attempts to display the same modal UserForm.
Document_Open and Document_New are separate events: one runs when a document opens, and the other runs when a new document is created from a template. Keep the events you need, but prevent redundant calls from displaying the form again while it is active.
Press Alt+F11, then open the affected document or template's ThisDocument module in the Project Explorer. Locate Document_Open and Document_New and look for calls such as frmBid1.Show.
Use Edit > Find in the VBA editor to search the project for the form's name and .Show calls. Check whether an event calls another procedure that also displays the form.
In the relevant event procedure, comment out or remove the extra form.Show statement. For example, comment out the call in Document_Open if that launch is unnecessary; keep Document_New if it serves a separate purpose.
Save the changes, close and reopen the document, or create a new document from the template using File > New. Confirm that the form opens only when intended and that error 402 no longer appears.

Hide or Unload the Modal UserForm Before Continuing
Use this approach when another form or action must run after the current modal UserForm is closed.
Edit Word Documents with WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for editing documents and moving everyday work from Microsoft Office. It does not repair Word VBA errors or guarantee compatibility with Word macros and UserForms.

Frequently Asked Questions
What causes Word VBA run-time error 402?
Error 402 can occur when code tries to perform an action that conflicts with an active modal UserForm. Check the form's Show calls and hide or unload the active form before displaying another form.
Where can I find Document_Open and Document_New?
Press Alt+F11 in desktop Word, then open the affected document or template's ThisDocument module in the VBA Project Explorer.
Should I delete both Document_Open and Document_New?
Not necessarily. Document_Open handles opening a document, while Document_New handles creating a document from a template. Remove or comment out only the redundant form launch after checking what each event does.
What is the difference between Me.Hide and Unload Me?
Me.Hide makes the form invisible while preserving its state. Unload Me closes the form and removes its state, so retrieve any values you need before unloading it.
Can WPS Office fix my Word VBA UserForm error?
No. Troubleshoot the VBA code in desktop Word. WPS Writer is an alternative for editing ordinary Word documents, but Word macros and UserForms are not guaranteed to work in it.




