在VBA中重绘UserForm

时间:2014-05-08 15:01:35

标签: vba userform redraw

我在VBA中有一个用户表单,我想在方法的中间重绘/更新它。

按下单击按钮调用方法时,功能如下:

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

/*Processing occurs*/

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

但是,仅在方法完成时才会发生对可见表单的更新。我得到val1,val2和" DONE"但不是" LOADING ......"信息。有没有办法在方法的中间重绘?

1 个答案:

答案 0 :(得分:1)

在加载消息后添加UsrForm.Repaint

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