Create a pause within a macro


Posted by Stuart on October 09, 2001 7:26 AM

Is there any way to create a pause in a macro? I want the macro to wait 5 seconds between two functions, but am unsure how to do it.

Any help appreciated.

Posted by Mark O'Brien on October 09, 2001 7:39 AM


Private Sub SetPause()
Dim newHour, newMinute, newSecond, waitTime
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
End Sub

Posted by Tom Morales on October 09, 2001 10:02 AM

Stuart - Add the following line to your code, at the appropriate juncture:

Application.Wait Now + TimeValue("00:00:05")

Tom



Posted by Stuart on October 10, 2001 8:01 PM

Thanks guys.