I am wrapping up an office application (VBA) that makes a call to a C# console application to perform some of the heavy lifting for the application (large simulation program). I would like to be able to have the VBA application wait for the console application to complete as well as retreive the exit code from the console application. I have been able to do the former, but have yet to be able to retrieve the exit code from the application. Is there any way that I can use something like
Diagnostics.Process.Start(filePath)
I have seen this in VB but not sure about VBA. Otherwise, any other suggestions?
Have a look at WaitForSingleObject and GetExitCodeProcess functions.
Example Usage:
This functionality has been wrapped up in the ShellAndWait function.
Excellent write up on it here.