pause macro execution

C

Claude

Hi all

I would like to pause the execution of the macro for a
split second, before continuing.
It would however seem I can only use the wait function to
pause for periods of 1 second and more e.g.

NewHour = Hour(Now())
NewMinute = Minute(Now())
NewSecond = Second(Now()) + 1
'NewSecond = Second(Now()) + 0.1 doesn't work
WaitTime = TimeSerial(NewHour, NewMinute, NewSecond)
Application.Wait WaitTime

Is there another way of doing this?
 
F

Frank Kabel

Hi

you may use the Sleep API call for smaller time interval. It takes as
its argument
the number of milleseconds.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub Test()
Sleep dwMilliseconds:=100&
End Sub
 
R

Rob van Gelder

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub test()
Sleep 500
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top