在 VBA 中重绘用户窗体 [英] Redraw a UserForm in VBA

查看:70
本文介绍了在 VBA 中重绘用户窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VBA 中有一个用户窗体,我想在方法中间重绘/更新它.

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"

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

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?

推荐答案

在加载消息后添加UsrForm.Repaint:

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

这篇关于在 VBA 中重绘用户窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆