How to know if userform running

Rasm

Well-known Member
Joined
Feb 9, 2011
Messages
505
I am using a XLAM add-in code - I have multiple forms - But I want to prevent the user from loading another userform unless I terminate the one already running.

So how can I determine which form may or may not be running?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I think to terminate or before loading other userform you can enter a line
Code:
[/FONT]
[FONT=Courier New]unload me[/FONT]
[FONT=Courier New]or [/FONT]
[FONT=Courier New]unload userform1[/FONT]
[FONT=Courier New]'etc[/FONT]
[FONT=Courier New]userform2.show 'vbmodeless if you want it to be modeless etc[/FONT]
[FONT=Courier New]


Not sure if this helps
 
Upvote 0
I tried the unload command - then immediately followed by my load command - but I get caught in a bad loop.
 
Upvote 0
Hello Rasm,

Perhaps this macro will help. It will display a dialog box listing the currently running or loaded UserForms.
Code:
Sub ShowUserFormList()

  Dim I As Integer
  Dim Msg As String
  
    For I = 0 To .UserForms.Count - 1
        Msg = Msg & UserForms(I).Name & vbCrLf
    Next I
    
    MsgBox "The follow UserForms are loaded or running:" & vbCrLf & Msg
    
End Sub
Sincerely,
Leith Ross
 
Upvote 0
Leith
Looks exactly like what I was looking for - I will try that - but sure looks like a winner
Thanks
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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