how to "Sleep" the program for 5 seconds??

C

Cherry

Did there is any macro code can ask the program to sleep
for 5 seconds and then run the next code??

Many Thanks
Cherry
 
T

Tushar Mehta

Depending on what application you are programming, check the OnTime
method or the Wait method. Worst case scenario, you will have to use
the 'sleep' Windows APIs. For an example see Shyam Pillai's
http://www.mvps.org/skp/ppt00021.htm

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
B

Bill James

The following routine waits in a loop allowing other
events to execute.

Sub Pause(Seconds As Double)
Dim Start As Double

Start = Timer()
While Timer() < Start + Seconds
DoEvents
Wend
End Sub

Example: Pause(0.5) ' Wait .5 seconds
Pause(5) ' Wait 5 seconds
 
Top