Pause a macro

  • Thread starter Thread starter AlanChidsey
  • Start date Start date
A

AlanChidsey

Friends,

How do I put in a command that will pause a macro for 10
seconds then have it automatically resume?

Thanks,
Alan
 
Hi Alan
try something like

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Have waited 5 seconds"
End If
 
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long
Sub Foo(
' You can use Application.Wai
MsgBox "Wait example start
newHour = Hour(Now()
newMinute = Minute(Now()
newSecond = Second(Now()) +
waitTime = TimeSerial(newHour, newMinute, newSecond
Application.Wait waitTim
MsgBox "Wait example End
' Or the Sleep api routine
MsgBox "Sleep Example Start
Sleep (3000
MsgBox "Sleep Example End
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

Back
Top