Excel2Gams VBA problem
Posted: Thu Nov 30, 2017 12:51 pm
Hello,
I am trying to run a couple of instances of gams in a sequential manner.
I use excel to change parameters and other input data and I execute gams from a VBA macro which executes Gams through acommand shell.
I have tried some approaches to wait for the GAMS code to finish running to change the parameters and execute the gams code automatically, but so far none has worked.
Approaches I have tried :
In VBA run a wait code so the VBA code waits around 1 minute (while my GAMS code runs in around 45sec).
In VBA run a code so it checks for a results file that GAMS creates to appear and then continue with code.
In vba check if the gams.exe process is running and as soon as it stops running (+5sec) continue with the code.
All these approaches make GAMS stop before running the model. The only approach that seems to be working is to set a msgbox and when gams stops running I manually click on the message box button to continue with the VBA code.
The cmd stops at this point, where it normally continues running creating all the results files.
Thanks for your help.
I am trying to run a couple of instances of gams in a sequential manner.
I use excel to change parameters and other input data and I execute gams from a VBA macro which executes Gams through acommand shell.
I have tried some approaches to wait for the GAMS code to finish running to change the parameters and execute the gams code automatically, but so far none has worked.
Approaches I have tried :
In VBA run a wait code so the VBA code waits around 1 minute (while my GAMS code runs in around 45sec).
In VBA run a code so it checks for a results file that GAMS creates to appear and then continue with code.
In vba check if the gams.exe process is running and as soon as it stops running (+5sec) continue with the code.
All these approaches make GAMS stop before running the model. The only approach that seems to be working is to set a msgbox and when gams stops running I manually click on the message box button to continue with the VBA code.
The cmd stops at this point, where it normally continues running creating all the results files.
Thanks for your help.