Excel 在指定的时间内将控件传递给用户
我有一个宏,它在可执行文件可用时运行命令提示符。宏在检查可执行文件是否可用之前等待5分钟。问题是这会锁定excel。我更愿意做的是将控制权传还给用户五分钟 这就是目前代码位的样子Excel 在指定的时间内将控件传递给用户,excel,vba,Excel,Vba,我有一个宏,它在可执行文件可用时运行命令提示符。宏在检查可执行文件是否可用之前等待5分钟。问题是这会锁定excel。我更愿意做的是将控制权传还给用户五分钟 这就是目前代码位的样子 Do Until TuflowEx < Range("Exe").Value ' Check if number of executables running is less than the user specified maximum Application.Wait (Now + TimeValue
Do Until TuflowEx < Range("Exe").Value ' Check if number of executables running is less than the user specified maximum
Application.Wait (Now + TimeValue("0:05:00")) ' Wait 5 minutes before checking again
TuflowEx = TuEx() ' Run TuEx to get the currently active number of executables
Loop
Do Until TuflowEx
干杯改用
只要创建一个例程来执行检查,如果检查成功,就让它恢复您的逻辑
Sub ChecktuflowEx()
If TuEx() => Range("Exe").Value Then
'whatever you want
Else
'Check again in 5 minutes.
Application.OnTime Now + TimeValue("0:05:00"), "ChecktuflowEx"
End If
End Sub
正是我需要的。谢谢