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?
Subreddit
Post Details
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/excel/comme...