Userform Modal

jstevens
GoldLounger
Posts: 2631
Joined: 26 Jan 2010, 16:31
Location: Southern California

Userform Modal

Post by jstevens »

I have VBA code to show UserForm1 as modal and a number of checkboxes on the form that get set to true when various code is run. The challenge is that the UserForm and checkboxes all turn grey until the code completes.

Example Code:

Code: Select all

UserForm1.Show modal

Call Run_some_code_01
UserForm1.CheckBox1 = True
   UserForm1.Repaint

Call Run_some_code_02
UserForm1.CheckBox2 = True
   UserForm1.Repaint

Call Run_some_code_03
UserForm1.CheckBox3 = True
   UserForm1.Repaint

Call Run_some_code_04
UserForm1.CheckBox4 = True
   UserForm1.Repaint
I am repainting the UserForm after each section of code because the checkboxes may not display the check mark until the form is refreshed.

Your thoughts are appreciated.
Regards,
John

User avatar
HansV
Administrator
Posts: 78788
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Userform Modal

Post by HansV »

For efficiency reasons, a userform is not updated while code runs unless you force it to using Repaint. I don't think there is a way around that.
Best wishes,
Hans