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)?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Dave

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

Dave Punky

Board Regular
Joined
Jan 7, 2010
Messages
133
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)?
 

Forum statistics

Threads
1,082,250
Messages
5,364,036
Members
400,774
Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top