Home → Troubleshooting → @RISK for Excel: Other Issues → "Error calling the macro ..."
Applies to:
@RISK, all releases
Evolver, all releases
On the Macros tab of my model settings, I list one or more macros to be called during a simulation or optimization. But I get this popup after I click Start:
Error calling the macro "..."
I've checked carefully, and the macro name is spelled correctly in the settings dialog. What is wrong?
This is probably a matter of scoping in Excel.
When @RISK calls a macro by name, Excel looks for it in several places. Depending on just where you placed the macro, its name alone may not be enough for Excel to locate it. Please follow these simple rules for best results:
In Visual Basic Editor, put your code in a module, not inside a worksheet object. If you need to create a module, right-click on the workbook name and select Insert » Module.
On the Macros tab of the model settings, fully qualify the macro name, using the workbookname!macroname form, such as 'My Own Workbook.xlsm'!MyMacro. It's usually not necessary to fully qualify the name, but it never hurts, and sometimes it is required.
Only a Sub
can be set to be called automatically by @RISK or Evolver, not a Function
.
Last edited: 2015-12-03