Home → Techniques and Tips → VBA Programming with @RISK → Setting References in Visual Basic
Applies to:
@RISK 5.x–8.x (Professional and Industrial Editions)
Evolver 5.x–8.x
NeuralTools 5.x–8.x
PrecisionTree 5.x–8.x
StatTools 5.x–8.x
You can set up VBA macros (macros written in Visual Basic for Applications) to automate these programs or to access their object model without depending on worksheet functions. To do this, you must tell the Visual Basic editor where to find the definitions of objects; this is known as setting references.
Therefore, if your VBA code needs to access objects, properties, and methods that are part of Palisade software, you must set references to one version of whichever Palisade tool contains the objects you need. Typically this comes up when you want to control @RISK or another application, for instance by setting simulation options, running a simulation, or fitting a distribution. On the other hand, if you just want @RISK to execute your code before or after every iteration or simulation, and your code doesn't directly access any @RISK objects, you don't need to set references in VBA.
To set references:
References are stored in the workbook when you click Save.
When you double-click a workbook that has references set, or open such a workbook through File » Open in Excel, the indicated Palisade software will open automatically, if it's not already running.
Release 8.x (using "8.x" as an abbreviation for 8.0, 8.1, or 8.5 as appropriate):
If you share a workbook with someone who has a different 8.x release number, the reference will adjust automatically on that person's computer. If they edit the workbook and send it back to you, the reference will again adjust automatically to match your computer. This works within 8.x versions, but between 5.x, 6.x, 7.x, and 8.x you must change the reference manually.
Automation Guides are included with the Professional and Industrial Editions of @RISK, Evolver, NeuralTools, and PrecisionTree. The Automation Guides introduce you to VBA programming in general and automating Palisade software in particular.
In @RISK, to access the Automation Guide, click Resources » Automating @RISK (XDK) » XDK Automation Guide.
In other applications to access the Automation Guide, click Help » Developer Kit (XDK) » Automation Guide.
Release 7.x (using "7.x" as an abbreviation for 7.0, 7.5, or 7.6 as appropriate):
If you share a workbook with someone who has a different 7.x release number, the reference will adjust automatically on that person's computer. If they edit the workbook and send it back to you, the reference will again adjust automatically to match your computer. This works within 7.x versions, but between 5.x, 6.x, and 7.x you must change the reference manually.
Automation Guides are included with the Professional and Industrial Editions of @RISK, Evolver, NeuralTools, and PrecisionTree. The Automation Guides introduce you to VBA programming in general and automating Palisade software in particular. To access an Automation Guide, click Help » Developer Kit (XDK) » Automation Guide.
Release 6.x (using "6.x" as an abbreviation for 6.0, 6.1, 6.2, or 6.3 as appropriate):
If you share a workbook with someone who has a different 6.x release number, the reference will adjust automatically on that person's computer. If they edit the workbook and send it back to you, the reference will again adjust automatically to match your computer. This works within 6.x versions, but between 5.x, 6.x, and 7.x you must change the reference manually.
Beginning with release 6.2, Automation Guides are included with the Professional and Industrial Editions of @RISK, Evolver, NeuralTools, and PrecisionTree. The Automation Guides introduce you to VBA programming in general and automating Palisade software in particular. To access an Automation Guide, click Help » Developer Kit (XDK) » Automation Guide.
Release 5.x (using "5.x" as an abbreviation for 5.0, 5.5, or 5.7 as appropriate):
See also: Using VBA to Change References to @RISK.
last edited: 2017-02-08