Question

I have a userform in VBA and I'd like to redraw/update it in the middle of a method.

When the method is called on button click, the function is as below:

UsrForm.Field1.Value = ""
UsrForm.Field2.Value = ""
UsrForm.Label1.Caption = "LOADING..."

/*Processing occurs*/

UsrForm.Field1.Value = val1
UsrForm.Field2.Value = val2
UsrForm.Label1.Caption = "DONE"

However, the update to the form visible only occurs when the method is completed. I get val1, val2, and "DONE" but not the "LOADING..." message. Is there a way to redraw in the middle of the method?

Was it helpful?

Solution

Add UsrForm.Repaint after the loading message:

UsrForm.Field1.Value = ""
UsrForm.Field2.Value = ""
UsrForm.Label1.Caption = "LOADING..."
UsrForm.Repaint
'...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top