GAMS and Excel: writing and checking results with automatic closing and opening

I often use the Gams utility gdxxrw to write the results of my model simulations to Excel. In the testing phase, if you don’t know some nice tricks, this means a lot of closing and opening Excel: If the result file is open in excel, you get an error, when you try to write results to the Excel file, so you have to close Excel first and rerun your simulation. After writing the results to Excel you have to reopen the file again. Lots of keystrokes…
However, gdxxrw lets you reduce the number of strokes, by using the gdxxrw utility xlstalk.
For the problem above, you could write the following:
       execute ‘xlstalk -S results.xlsx’
       execute ‘gdxxrw.exe results.xlsx i=results.gdx ….’
       execute ‘xlstalk -O results.xlsx’
The first line saves the file results.xlsx and closes it (if open) and closes Excel. The second line is the command line for writing the results to the file. The last line opens the file in Excel.
Using this lines, you can run your model over and over again without manually closing and opening Excel.