我想在 Excel 的 macOS VBA 编辑器中添加 500 毫秒的等待块。我知道
Application.Wait (Now + TimeValue("0:00:01"))
Run Code Online (Sandbox Code Playgroud)
可以,但是不能低于 1 秒。我也尝试过 sleep 命令:
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
...
Sleep 500
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误说
File Not Found "kernel32"
Run Code Online (Sandbox Code Playgroud)
有什么办法可以实现这个目标吗?
小智 -2
上面的代码块只需添加一点即可工作。只需将 TimeValue 除以 2 即可得到 500 毫秒
Application.Wait (Now + TimeValue("0:00:01") / 2)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1178 次 |
| 最近记录: |