Coming soon - Get a detailed view of why an account is flagged as spam!
view details
4
[VBA] Create pause to allow .exe to run
Author Summary
gulbronson is in VBA
Post Body

I have a sub routine that creates an input file for another program, uses the shell function to run the input file in another program using python and then reads the output file.

The code looks like this

Sub call_exe()

code to create input file

RetVal = Shell("<path to python.exe> " & "<path to python script>")

code to read output file

End Sub

The problem is that after calling the shell function, my macro keeps going and attempts to read the output file before it is created because the other program has not finished its analysis yet. I found the python script online and it is used to call an obscure engineering program. Initially I wanted to create a COM wrapper that could be implemented with VBA, but this proved to be a more difficult task than I anticipated.

Is there a way to pause the macro until the other program has finished, or should I take the easy route and split it up into two different subs that have to be called individually?

Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
155,151
Link Karma
29,387
Comment Karma
124,641
Profile updated: 1 week ago
Posts updated: 9 months ago
9

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 years ago