小编Nic*_*ick的帖子

如何让 VBA 代码等到 vbModeless 用户窗体关闭

我想使用无格式的用户表单,以便用户可以在回答用户表单上的问题之前浏览 Excel 表。我需要暂停或循环代码,直到用户窗体关闭(隐藏或卸载)。

与此类似的问题: 当表单关闭并设置为 vbModeless 时,如何等待特定代码运行? 但这里的解决方案不适用于我的应用程序;我的用户窗体在一个长子程序的中间打开,该子程序需要在用户窗体关闭后完成执行。

Dim popupActive as Boolean

popupActive = True
StartingSINT_Popup.Show vbModeless 'Open userform

'have VBA code wait until userform is closed
wait until popupActive = False 'set to false with OK button on userform

'continue code with info input inside StartingSINT_Popup userform
Run Code Online (Sandbox Code Playgroud)

excel vba userform

2
推荐指数
1
解决办法
4085
查看次数

标签 统计

excel ×1

userform ×1

vba ×1