HomeTechniques and TipsVBA Programming with @RISKSetting References in Visual Basic

10.2. Setting References in Visual Basic

Applies to:
@RISK 5.x–7.x (Professional and Industrial Editions)
Evolver 5.x–7.x
NeuralTools 5.x–7.x
PrecisionTree 5.x–7.x
StatTools 5.x–7.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:

  1. In Visual Basic editor, click Tools » References.
  2. Remove check marks from any outdated libraries, such as AtRisk, RiskXL, Risk, and Risk5.
  3. In the References window, select the appropriate item or items for your program and release number, as listed below. (You will see many Palisade entries. Select the ones listed in this article, and no others. Select only one version; you cannot have both versions 6 and 7 checked, for instance.)
  4. Click OK to close the References window.

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 7.x (using "7.x" as an abbreviation for 7.0 or 7.5 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.

  • For @RISK 7.x: both RiskXLA and Palisade @RISK 7.x for Excel Object Library. If you have RISK Industrial and you want to use the RISKOptimizer part of the object model, select Palisade RISKOptimizer 7.x for Excel Developer Kit also.
  • For Evolver 7.x: both EvolverXLA and Palisade Evolver 7.x for Excel Developer Kit.
  • For NeuralTools 7.x: NeuralTools only (without "Palisade").
  • For PrecisionTree 7.x: both PtreeXLA and Palisade PrecisionTree 7.x Object Library.
  • For StatTools 7.x: Palisade StatTools 7.x Object Library only.

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.

  • For @RISK 6.x: both RiskXLA and Palisade @RISK 6.x for Excel Object Library. If you want to use the RISKOptimizer part of the object model, select Palisade RISKOptimizer 6.x for Excel Developer Kit also.
  • For Evolver 6.x: both EvolverXLA and Palisade Evolver 6.x for Excel Developer Kit.
  • For NeuralTools 6.x: NeuralTools (without "Palisade").
  • For PrecisionTree 6.x: both PtreeXLA and Palisade PrecisionTree 6.x Object Library.
  • For StatTools 6.x: Palisade StatTools 6.x Object Library.

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):

  • For @RISK 5.x: Palisade @RISK 5.x for Excel Object Library
  • For RISKOptimizer: Palisade RISKOptimizer 5.x for Excel Developer Kit.
  • For Evolver 5.x: Palisade Evolver 5.x for Excel Developer Kit.
  • For NeuralTools 5.5 and 5.7: NeuralTools (without "Palisade").
    (There was no NeuralTools 5.0 automation interface.)
  • For PrecisionTree 5.x: Palisade PrecisionTree 5.x Object Library.
  • For StatTools 5.x: Palisade StatTools 5.x Object Library.

See also: Using VBA to Change References to @RISK.

last edited: 2017-02-08

This page was: Helpful | Not Helpful