HomeTechniques and TipsVBA Programming with @RISKPlacing Markers in Graphs

10.10. Placing Markers in Graphs

Applies to:
@RISK 6.2 and newer

I'd like to place a histogram in my worksheet with markers on it, such as the mean or a percentile. How can I do that? Do you have an example?

You can do this by using VBA (Visual basic for Applications). Specifically, you'll need these members of the RiskGraph object: MarkerEnabled and possibly MarkerRedefine.

To get started in controlling @RISK with VBA, see the Automation Guide, Help » Developer Kit (XDK) in the menu. The Automation Guide includes a basic graph example. For customizations, see the XDK Reference in the same menu.

The attached example, based on the "Risk.XDK First program" example in the Automation Guide, shows how to add several of the markers to a histogram. Some extra code in the example displays all of the available markers in the Immediate Window. To run the example, download it and open it in @RISK, then press Alt+F11 to display the VBA Editor. The FirstProgram subroutine should be displayed. If it is, scroll to the bottom to see the marker code, then click anywhere in the code and press F5 to run it.

You may need to change one or two things in the example, depending on your situation:

A couple of the marker names might be a bit obscure:

Last edited: 2019-01-10


This page was: Helpful | Not Helpful