Hi all,
I want to add a "wait state" to an procedure. So something like
Procedure AAA
Do XYZ
Wait x seconds...
End Sub
How do i do this?
Printable View
Hi all,
I want to add a "wait state" to an procedure. So something like
Procedure AAA
Do XYZ
Wait x seconds...
End Sub
How do i do this?
Something as simple as this quick sample may work for you:
Code:Option Explicit
Private Sub Command1_Click()
Dim t As Double
t = Timer + 5 'wait 5 seconds
Debug.Print Now
Do While Timer < t
DoEvents
Loop
Debug.Print Now
End Sub
You could also add this statement to a module...
Code:Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
...and then call it usingor whatever number. Just note that it's in milliseconds.Code:Sleep 1000
Sleep suspends execution of the entire current thread which in many cases might not acceptible.
SleepEx could be better choice, although it suspends the entire thread as well.
VSCM
As a matter of clarification, note that in RhinoBull's post #2,
there is a difference:
- function - he is using the Timer function
- control - as distinct from a Timer control
Spoo