New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Keeping a UserForm visible during code execution

Free Excel Tips and Tutorials

Keeping a UserForm visible during code execution

Postby ez08mba » Wed Jan 09, 2013 4:19 pm

How to keep a UserForm open during code execution from beginning to end. And it is embarrassingly simple.

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

You do not have the required permissions to view the files attached to this post.
ez08mba
Regular
 
Posts: 68
Joined: Feb 2, 2012
Location: Dayton, Ohio
Reputation: 0
Excel Version: 2007/2010

Return to Excel Tips and Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron