如果你要的是无响应延时,即延时过程中不能做任何事情,可以用SleepEx函数: Public Declare Function SleepEx Lib "kernel32" (ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As Long如你要延时1秒钟,则用: SleepEx 1000, 0如果你要的是可响应延时,一般可以用DoEvents循环,如你想要延时1秒钟:Dim t1 As Single Dim t2 As Single t1 = Timer Do t2 = Timer If Abs(t2 - t1) >= 1 Then Exit Do DoEvents Loop
Public Declare Function SleepEx Lib "kernel32" (ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As Long如你要延时1秒钟,则用:
SleepEx 1000, 0如果你要的是可响应延时,一般可以用DoEvents循环,如你想要延时1秒钟:Dim t1 As Single
Dim t2 As Single
t1 = Timer
Do
t2 = Timer
If Abs(t2 - t1) >= 1 Then Exit Do
DoEvents
Loop