VBA:延时

宏最上面:Private Declare Function timeGetTime Lib "winmm.dll" () As Long

Private Sub wait(aa)

Dim Savetime As Double
Text1 = "timeGetTime begin"
Savetime = timeGetTime '记下开始时的时间
While timeGetTime < Savetime + aa '循环等待
DoEvents '转让控制权,以便让操作系统处理其它的事件
Wend
Text1 = "timeGetTime end"
End Sub

调用 

Call wait(300)

 

posted @ 2021-08-06 15:44  myrj  阅读(619)  评论(0编辑  收藏  举报