|
The results sheet is as follows

where
| • | The material in the red box will be placed in this workssheet by Gdxxrw as guided by the commands in the blue box. |
| • | The material in the blue box is the set of commands telling Gdxxrw what types of items, item names, and ranges to write into excelincharge.xls as covered in the Links to Other Programs Including Spreadsheets chapter using the index option where the commands are imbedded in the spreadsheet. This will be addressed in the excelincharge.gms file using the command. |
Execute 'Gdxxrw Excelincharge.gdx skipempty=0 zeroout=0 trace=2 index=results!e1'
| • | The worksheet is not shared so a trick is used to permit Gdxxrw to write to it. Namely the macro goes through the following steps |
| I. | The spreadsheet is saved so the current data is on the disk. |
| II. | The spreadsheet is saved as excelincharge.xls. This: |
| a. | Closes the base spreadsheet making it ready for GDXXRW to write |
| b. | Causes the screen to show excelincharge.xls while GAMS is solving causing the screen image to be preserved while GAMS is running |
| II. | Runs GAMS which in turn uses Gdxxrw |
| III. | Signals completion of the GAMS run |
| IV. | Reopens the base spreadsheet excelincharge.xls which will now contain the solution passed by Gdxxrw and shows it on the screen |
| V. | Closes excelincharge.xls |
|