Custom applications and macros | Vose Software

Custom applications and macros


ModelRisk can be used in any programming language that supports calls to DLLs, for example Visual Basic, C++ and Delphi. ModelRisk has a COM-object called ModelRisk Library which is automatically registered in a local system when ModelRisk is installed.

The ModelRisk VBA functions Library Help file provides the documentation of the ModelRisk Library COM Object and is available from the ModelRisk Ribbon under Help menu:

Example: ModelRisk and Visual Basic

To access ModelRisk functions from Visual Basic, for example, one needs to register ModelRisk as a reference for the VB project.


In the Excel VBA editor (brought up with ALT+F11), select Tools from the menu, then References... In the References window presented, mark the ModelRisk Library in the list (see screenshot on the right).

Now when you are writing VBA code, you can call ModelRisk functions, so you can use commands like


To see the available functions in the ModelRisk Library once it is added to the references, open the Object Browser (F2) and then select ModelRisk from the first combo-box.








An example of a VB routine is given below:

Sub TestMR()

' Sample from the bounded Normal(0,1) distribution

Dim Sample As Double

Sample = ModelRisk.VoseNormal(0, 1, , VosePBounds(0.1, 0.9))

' Calculate the combined probability of observing

' the values 125, 112 and 94 from Poisson(100) distribution

Dim Prob as Double

Dim Values As Variant

Values = Array(125, 112, 94)

Prob = ModelRisk.VosePoissonProb(Values, 100, 0)

' Use Central Limit Theorem to sample from the

' distribution of the sum of 120 Normal(25,3) distributions

Dim CLT As Double

CLT = ModelRisk.VoseCLTSum(120, 25, 3)

' Print the output values to the Debug console

Debug.Print Sample, Prob, CLT

End Sub


ModelRisk’s COM Object offers a limited number of ModelRisk tools, such as distributions, Copulas, Time Series.

The ModelRisk tools are also available to programmers in the ModelRisk Dynamic-Link Library (DLL), which allows integrating the power of ModelRisk into custom, non-spreadsheet standalone applications. For more information regarding the ModelRisk DLL please contact us at