Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/questions/55926451/how-to-have-vba-code-wait-until-vbmodeless-userform-is-closed

Note: This may not be the proper way, but it is easy to add to existing code. See here for "proper method" → Event Driven Modeless UserForms - VBA

Module:

Public ModelessFormShowing As Boolean
Public Sub WaitForModelessUserForm()
 Do While ModelessFormShowing = True
 DoEvents
 Loop
End Sub
Sub CallUF()
 ModelessFormShowing = True
 UserForm.Show vbModeless
 Call WaitForModelessUserForm
 'Continue Code
End Sub

Then just add this to exit statement of UserForm:

ModelessFormShowing = False





  • No labels