Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple VBA question - equivalent of sleep

Status
Not open for further replies.

MavrickStl

Programmer
Feb 20, 2001
71
US
Guys,

My excel macro runs a batch script using shell command and other VBA code. I would like to know what command in VB I can use to stop executing of VBA code until my batch script is finished.

VBA code lines1
somewhere in between I am calling shell to run a batch file
More VBA code lines2

What command I can use to stop execution of More VBA code lines2 until my batch operation is finished. In older days people used sleep to wait for a job to finished until the next one started

Thanks,

Amit
 
The secret is in using DoEvents this allows the system to pause and do other processing until a condition is met.

You could create a timer and wait a period of time as you loop through using DoEvents. When the time is up then the code will exit the loop.

I suggest searching this site for the keyword DoEvents and you are sure to find some good examples.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top