Modeless userform disappears when a modal userform closes

mcomp72

Active Member
Joined
Aug 14, 2016
Messages
305
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
In my workbook, I have a userform that is visible whenever a particular worksheet is the ActiveSheet. This userform is modeless, and it has buttons on it. Some of the buttons open other userforms. These other userforms are not modeless (I believe they call those 'modal'.)

If I click one of the buttons to open one of these modal userforms and then close that userform, the modeless one also disappears. But there is no code being executed that tells the modeless one to disappear. So I can't understand why it's happening. Is this normal behavior for Excel? Or should a modeless userform stay visible until either the user closes it or a specific line of code hides/unloads it?

I'm not sure of how well I've explained it, so I recorded a short video showing what is happening.

Any ideas why this is happening?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
That is not the behaviour I experienced in my testings (the first modeless userfor stays open after closing the second one)
You should investigate the content of the sub that closes userform2 and the userform2 event macro, such as Sub UserForm_Deactivate, Sub UserForm_Terminate, Sub UserForm_QueryClose and maybe someone more
 
Upvote 0
Alos, try placing a MsgBox in he Terminate event of the first modeless userform.
If the Msgbox appears when the modeless userform disappears from view, it means that the modeless UserForm is indeed unloaded. If not, it is just hidden for some reason.
 
Upvote 0
Alos, try placing a MsgBox in he Terminate event of the first modeless userform.
If the Msgbox appears when the modeless userform disappears from view, it means that the modeless UserForm is indeed unloaded. If not, it is just hidden for some reason.
Debug.Print statement would work too.
 
Upvote 0
Thanks to all of you for the suggestions. I have an interesting update.

Last night I rebooted my computer. I opened the file just now to try your suggestions, but before doing so, I tried using the two userforms again. Now the modeless userform does NOT disappear when I close the modal userform. So I guess it was just some fluke behavior? It never even occurred to me to reboot my computer to see if that would have any effect.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top