microsoftword中vba宏的延迟运行



如何在一个模块中间歇性地运行两个宏(两个子流程(,并且我们有一个延迟(例如700秒的等待时间(来请求用户将光标的位置更改为所需位置,然后根据光标的新位置运行第二个宏

Sub Main()
'Here you execute or run the 1st macro
call Macro1
'Now we inform the user with a messagebox
'for the next action they have to take
'and the time limit within which to complete the action
'after closing the msgbox
msgbox "You have 10 seconds after you close this to move your mouse."
dim WaitUntil
WaitUntil=Now+timeserial(0,0,10)
'Wait a certain amount of time
do while now<=WaitUntil
doevent
loop

'Now user must have completed the manual action
'so we can proceed with the second Macro
call Macro2
End Sub
Sub Macro1()
'code
End Sub
Sub Macro2()
'code
End Sub

最新更新