Enabling Macro Functionality

Some the general equilibrium models use Excel macros to control details of the problem being solved. The macros are not required to use the models, but do allow for some advanced functionality. For example, in the HOS model with interventions, if you only want to explore price mechanisms then you do not need to allow macros. However, to explore more advanced topics including quantitative restrictions, the macro is required. By default the security settings in Excel will not allow macros. In Excel 2003 or earlier you can allow the macros by opening Excel, then going to the Tools menu, selecting Macros, and then selecting Security. The following dialog will open:

If it is not selected already, select the Medium security level (on some systems this might require administrator privileges, if so consult your computer support). Click OK, and close Excel. Reopen Excel and open the model file. The following dialog will appear:

You should click Enable Macros at this point. The sheet will then open, and the macros should function correctly. You can test this by clicking the Solve model button in the sheet. 

In Excel 2007 security is arranged differently. To allow the macros you must change the Trust settings. To do this click the Office button in the top left corner of Excel, and select Excel Options from the drop down menu. In the dialog on the left choose Trust Center, then click the Trust Center Settings button on the right. Select Trusted Locations, and on the right hand side click the Add new location button. A dialog box will open allowing you to add a new trusted location. You can browse for the folder in which you have saved the model (e.g.: c:\Users\jgilbert\Documents) or enter it directly. When you have finished click OK to exit all the open dialogs. Close Excel and open the file.

Unfortunately, Macro functionality is not available for users of Excel 2008 on the Mac due to the lack of VBA support.

On some Excel installations when you try and run the model by pressing the Solve model button on the sheet (which activates the macro), a Visual Basic window may appear with the following message:

We have set the sheets to work with Excel 2007 defaults, so this should be a relatively rare situation. The problem is that Excel cannot find the Solver add-in that is being called by the macro. First, make sure you have actually installed it following the instructions here. Close and restart the sheet. If the problem reoccurs, the Solver add-in is not where the sheet expects it to be. First click OK to clear the dialog, then staying in Visual Basic, from the Run menu choose Reset. Next, from the Tools menu select References. You should see the following dialog:

The problem is with the missing reference to SOLVER.XLA (or SOLVER.XLAM in Excel 2007). Deselect the missing item, and look in the references list for an item labeled SOLVER. Select this and close the dialog, close Visual Basic and save the sheet. If SOLVER is not on the list you will have to browse for the location of the file Solver.xla for Excel 2003 and earlier, and Solver.xlam for Excel 2007. By default this should be in a directory like C:\Program Files\Microsoft Office\Office11\Library\Solver\, or Office12 for Excel 2007, but this can vary slightly. Again, once you have selected it, close everything and save the sheet with the new reference. This will prevent the problem from reoccurring with your installation.