문제

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?

도움이 되었습니까?

해결책

Add UsrForm.Repaint after the loading message:

UsrForm.Field1.Value = ""
UsrForm.Field2.Value = ""
UsrForm.Label1.Caption = "LOADING..."
UsrForm.Repaint
'...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top