Userform over userform (acting as Modal)

Dave Punky

Board Regular
Joined
Jan 7, 2010
Messages
133
Hi all,

I'm having a minor issue and was wondering if anyone had got around this.

Basically I've got a Userform (that's modeless) which acts as a primary hub for information. I then have several other Userforms that open from this which ideally I would want to act modally (or really just dominates focus until the form is submitted / closed).

I've been defining the forms as Modal on initialize like so:
Code:
Userform.show vbModal

The only downside to doing this is on the then opened userform, once that form is terminated it seems to terminate the primary Userform also (even though the only code left to run is to end the sub). The only way around this I've managed to find is by doing the following in the "dominant" userform:

Code:
Sub Userform_Terminate

Userform.show vbModeless

End Sub

The only downside I've noticed to this is that it takes focus away from the primary form, and because Userforms initially don't appear to have a .SetFocus it doesn't seem possible to give focus back without the user clicking the form (and if the button was launched from a frame, that particular frame seems to need to be clicked).

I'm thinking setting Modal / Modeless probably isn't the best way around this, so is there any other ways of doing this (which may be better suited to my needs)?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Dave

Would hiding the 'pop-up' forms be an option? That seemed to work no problem when I tried it.
 
Upvote 0
Hi Norie,

Admittedly now I'm wondering why I didn't think to do that, as that also seems to be working for me (doesn't appear to be causing the crashing issues either that seem to happen when the form is unloaded). Thank you for replying so quickly!

Is there any downsides to doing that which I may not be seeing (i.e. additional load, etc)?
 
Upvote 0

Forum statistics

Threads
1,223,155
Messages
6,170,405
Members
452,325
Latest member
BlahQz

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