Time Delay in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to create a time delay in a macro. I would like excel to
wait, say 5 minutes, while an external script triggered by that same macro
finishes running.
 
VBA offers two ways.

have a look at Application.OnTime
to schedule a "PostExternalProcess " macro to start
at a specified time.(which allows the user or any other code to run while
you wait for the time to elapse...)

dim dtOnTime as date
dtOnTime = now+timeserial(0,5,0)
application.ontime dtOnTime,"MyPostProc"

(you'll need the variable to be able to reschedule or cancel it)

Or just completely freeze Excel..
(Just allow external apps with)
Application.wait now+timeserial(0,5,0)

There's some api functions as well,
but probably beyond the current scope.



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

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

Similar Threads

Time Delay for Macros 4
Simple Variable to someone 5
Copy/Time Delay 6
time delay 3
Time Out a MsgBox 7
Time Delayed Response to MsgBox 5
OnTime Challenge 4
Time Dealy in VBA 1

Back
Top