Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

creating a pause in a for Loop in Excel VBA

Status
Not open for further replies.

tazengr

Mechanical
Mar 1, 2007
34
0
0
DE
Hello,

I have written a For loop that uses a shell command to call a batch file that replaces text in a trail file, Mytrail.txt. I then use that altered text file and use it to run Pro/Engineer by calling it through another shell command. I would like to add pause instructions to my routine after the shell commands to ensure that each time the text file is changed Pro/Engineer runs the instructions described in the trail file exactly once. Below is a snippet of the code I am working with:

For i = 1 To N Step 1
Shell ("Reblacer.bat Mytrail.txt string_A string_B)

'Here I would like to add code that will pause the routine 'until the batch file operation is complete.

Shell "C:\Program Files\proeWildfire 3.0\bin\proe.exe Mytrail.txt", vbNormalFocus

'Here I would like to add another pause instruction until 'the above shell command is complete. Note that this shell 'command creates a new file in some directory whose name is 'actually string_A.prt. Could this be used to tell visual 'basic that it may recontinue executing the routine.

Next i
End Sub

Does anyone know how to add pauses to the routine above that prompt visual basic to continue executing the code only after the shell commands have completed their tasks?

Regards,
TazEngr
 
Status
Not open for further replies.
Back
Top