How to Keep a Modeless VBA UserForm Visible Behind a Modal Form
Question details
The user needs a modeless VBA UserForm to remain visible in the background when a secondary modal help form is hidden or unloaded.

- Product
- VBA Macros
- Device & OS
- Windows
- Scenario
- Running multiple VBA UserForms simultaneously, where one is modeless and serves as the main interface, while the other is modal.
- Observed behavior
- The main modeless UserForm unexpectedly disappears or unloads from the screen when the modal form is closed, hidden, or unloaded.
Before modifying your code, ensure you have saved your macro-enabled workbook or presentation to prevent any data loss in case the VBA editor freezes.
Restart Windows to Clear Application State
Use this solution when the VBA compiler acts unpredictably, which often happens after extensive debugging sessions that corrupt the application memory state.
During heavy VBA debugging, the Office application environment can sometimes get stuck in an unstable state. This can cause forms to disappear unexpectedly despite having correct code.
Save your macro-enabled workbooks or presentations and completely close out of all running Office applications.
Click the Start menu, select Power, and choose Restart to clear your computer's memory and reset background processes.
After rebooting, reopen your file and trigger the UserForms to verify if the modeless form now stays visible.

Verify Variable Names and Typographical Errors
Use this step to rule out coding mistakes, such as hiding or unloading the wrong UserForm variable.
Isolate the Code in a Sample File
Testing your logic in a fresh, blank file helps determine whether the issue is caused by the code itself or is specific to the original file's corruption.
Discover a Lighter, More Stable Office Alternative
If you frequently encounter application state issues or glitches while working with complex files in Microsoft Office, consider trying WPS Office. It is a highly compatible, lightweight, and free alternative that ensures a seamless workflow for all your spreadsheets, documents, and presentations.
- 1. Download the installer: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the software: Run the installer and follow the on-screen instructions to set up the lightweight application in minutes.
- 3. Open your files: Simply double-click your existing Office documents or macro-enabled files to open them seamlessly in WPS Office.

Frequently Asked Questions
What is the difference between a modal and modeless UserForm in VBA?
A modal UserForm requires the user to interact with it and close it before they can return to the main application or click on other forms. A modeless UserForm allows the user to continue interacting with the background application and other modeless forms while it remains open.
How do I show a VBA UserForm as modeless?
You can display a UserForm as modeless by passing vbModeless (or the value 0) as an argument to the Show method, for example: UserForm1.Show vbModeless.
Why does my VBA code act unpredictably during debugging?
During heavy debugging—such as repeatedly stopping, modifying, and resuming code execution—the VBA compiler's memory state can become corrupted. Restarting the Office application or Windows helps clear this residual state and restores normal behavior.
Will my existing VBA macros work in WPS Office?
Yes, the premium versions of WPS Office include support for VBA macros, providing high compatibility with existing Microsoft Office macro-enabled files like .xlsm, .docm, and .pptm.




