View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Time Delay in VBA


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


"?B?Sm9obiBUb2xtYW4=?="
wrote:

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.