ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Time Delay in VBA (https://www.excelbanter.com/excel-programming/314820-time-delay-vba.html)

John Tolman[_2_]

Time Delay in VBA
 
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.

Frank Kabel

Time Delay in VBA
 
Hi
have a look at
wait
in the vBA help

--
Regards
Frank Kabel
Frankfurt, Germany

"John Tolman" schrieb im
Newsbeitrag ...
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.



keepITcool

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.



Jim Cone

Time Delay in VBA
 
John,

Maybe...
"How To Use a 32-Bit Application to Determine When a Shelled Process Ends"
http://support.microsoft.com/?kbid=129796

Regards,
Jim Cone
San Francisco, CA

"John Tolman"
wrote in message ...
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.



All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com