I spent a lot of time reviewing and searching VBA information on the Internet and in books and never found anyone with an easy solution to keeping a "Processing" message (userform) open without having to do some sort or code calculation and loop. Well, it is 'stupidly simple' and here is how.
After you have created your userform (e.g. formProcessing) do the following:
1) Select your form and hit F4 to open the form properities
2) find the property called "ShowModal"
3) Change the value from True to "FALSE"
You may have to include a processing delay to give the form a chance to completely open with an:
- Code: Select all
Application.Wait Now + TimeValue("00:00:01")
Now just enter the "show" and "unload" statements whereever you want the form to open then close. If you are using a primary form, then you can use Public Variables as Booleans to carry those values across Sub procedures. Then you can switch your processing window off and on throughout the project.
- Code: Select all
Sub FormProcessing()
' START OF CODE
[CODE STATEMENTS...]
[CODE STATEMENTS...]
[CODE STATEMENTS...]
[CODE STATEMENTS...]
formProcessing.Show
[CODE STATEMENTS...]
[CODE STATEMENTS...]
[CODE STATEMENTS...]
[CODE STATEMENTS...]
Unload formProcessing
Msgbox "Processing Complete"
End Sub