Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 在指定的时间内将控件传递给用户_Excel_Vba - Fatal编程技术网

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

我有一个宏,它在可执行文件可用时运行命令提示符。宏在检查可执行文件是否可用之前等待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("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

正是我需要的。谢谢