Excel Link

Excel Link

This example illustrates both the Spreadsheet function library and the Excel Add-In. This example also shows how AIMMS handles run time errors.

If you start up the AIMMS project (ExcelLink.aimms), you can exchange the input and output data in Excel using the Spreadsheet function library. The procedures in the "Excel Linkage" section of the model tree illustrate the required calls. When reading data from Excel, a more difficult part is that the cell range information is not available. The procedure "DetermineConsecutiveRange" shows how to deal with such a situation. The example reads and writes data from and to an Excel file called AIMMSExample.xls.

If you start up the Excel spreadsheet (ExcelAddInExample.xls or Excel64AddInExample.xls), you can exchange the data contained in it with AIMMS using the Excel Add-In. The example uses an AIMMS model containing a simple transport model, and stores the input and output data of the model in an Excel spreadsheet. The actions specified in the "Aimms Interface Setup" dialog box correspond one-to-one to the calls to the Excel function library in the "Excel Linkage" section of the model tree.

To use the Excel Add-In you have to install the AIMMS Launcher, which can be downloaded hereThis program will create the registry keys necessary for the Excel Add-in to work.

Keywords

Excel Add-In, Spreadsheet functions, Run Time Error Handling.

Download

A zip file with this example can be downloaded here.

Notes

If you start up the Excel spreadsheet by ExcelAddInExample.xls or Excel64AddInExample.xls then AIMMS will try to open the AIMMS version as specified in the ExcelLink.aimms file. If you want to use a newer version of AIMMS then you have to make sure that the AIMMS version in the ExcelLink.aimms file is updated to that version. You can manually edit this file. A safer option is to start up the project using the newer AIMMS version, make a dummy change in the project, and save the project. The version number in the ExcelLink.aimms file will now be updated.

You should also update the AIMMS version in the ExcelLink.aimms file if you get an AIMMS COM related error. 

More troubleshooting for the Excel Add-In can be found in the knowledge base.