@RISK | DecisionTool Suite | @RISK for Project | NeuralTools | StatTools | TopRank | RISKOptimizer | PrecisionTree | Evolver | Books
°¡°ÝÇ¥ | ¶óÀ̼¾½º | ÁÖ¹® | ¹®ÀÇ
±³À° ÀÏÁ¤ | ÄÁ¼³ÆÃ | ¹æ¹® ±³À° | Training CD
FAQ | »ç¿ëÀÚ µî·Ï | ±â¼ú Áö¿ø ¿äû
ÁúÀÇ ÀÀ´ä °Ô½ÃÆÇ
@RISK Macro Functions

New @RISK 4.5 lets you write your own custom applications in Excel that can perform virtually any @RISK function. Harness the power of @RISK's Monte Carlo simulation engine for your company's specific needs. Utilise @RISK's extensive reporting options, Sensitivity analysis, Scenario analysis, distribution fitting, and more, all in your own custom Excel programme!

Example files are included demonstrating how to use these commands. These example files - RiskMacro.XLS and FitMacro.XLS - illustrate the use of @RISK functions and types in VBA. RiskMacro.XLS shows how to use @RISK macro functions to run simulations and retrieve simulation results. FitMacro.XLS illustrates the use of @RISK VBA functions to fit probability distributions to data.
     Click here to download RiskMacro.XLS (22 KB).
     Click here to download FitMacro.XLS (20 KB).

Complete lists of @RISK VBA macro functions and public variables appear below.

Function

Description

RiskAddOutput(cellRange As range, Optional outputName, Optional rangeName)

Adds the cellRange specified as an @RISK Output

RiskDisplayAlerts(Optional newValue)

Turns the display of @RISK messages to users on and off

RiskError(errorIndex%)

Returns a descriptive string for the error given by errorIndex.?

RiskFitDeleteTab(fitTabName$)

Deletes the FitTab with the name fitTabName.

RiskFitDistributions(fitInfo As RiskFitType)

Runs a fit based on the information in fitInfo.

RiskFitGetChiSqBins(fitTabName$, fitName$, numBins%, binMinima#(), binMaxima#(), actualOccupations#(), theoreticalOccupations#())

Returns the details about how the bins were configured for the chi-squared test for the fit named fitName on the tab named fitTabName.

RiskFitGetCriticalValue(fitTabName$, fitName$, whichStatistic%, alpha#, cValue#)

Returns the critical value associated the test specified by whichStatistic, given the significance level alpha, for the fit named fitName on the tab named fitTabName.

RiskFitGetDefaults(fitInfo As RiskFitType)

Fills in fitInfo with the default values used for new fits in @RISK.

RiskFitGetFunction(fitTabName$, rankBy%, rankOrName, functionFormat%, theFunction$)

Returns, in theFunction, a fitted distribution in the form of an @RISK spreadsheet formula, formatted display string, or name of a fitted distribution.

RiskFitGetNumValidFits(fitTabName$, numValidFits%)

Returns the number of valid fits for a fitTabName$.

RiskFitGetPercentile(fitTabName$, fitName$, p#, x#)

Returns the percentile, x, corresponding to an input p value for a fit named fitName on the tab named fitTabName.?If fitName is a blank string, the percentile of the input data is returned.

RiskFitGetStats(fitTabName$, fitName$, theStats As RiskStatsType)

Returns the statistics of the fit with name fitName in the tab named fitTabName.?If fitName is a blank string, the statistics of the input data are returned.

RiskFitGetTarget(fitTabName$, fitName$, x#, p#)

Returns the target, p, corresponding to an input x value for a fit named fitName on the tab named fitTabName.?If fitName is a blank string, the target of the input data is returned.

RiskFitGetTestResults(fitTabName$, fitName$, whichStatistic%, testValue#, pValueString$, rank%)

Returns a fit statistic for a fit named fitName on the tab named fitTabName.

RiskGenerateReports(Optional whichReports, Optional inNewWorkbook, Optional templateSheetName)

Using the current @RISK results, generates a set of reports and puts them in Excel.  ?All arguments to this function are optional.?If any are missing, the current @RISK settings for these arguments are used.

RiskGetCorrelation(cellRefOrName, simNum&, numInputs&, sensInfo() As RiskSensitivityType)

Returns correlation sensitivities between the simulation output cellRefOrName and the input distributions in the simulation.

RiskGetCellInfo(cellRef As Range, info As RiskCellInfoType)

Returns information on @RISK functions located in a worksheet cell.?

RiskGetData(cellRefOrName, inputOrOutput%, simNum&, theData#())

Fills an array theData with the data calculated during the simulation for the input or output cellRefOrName.?

RiskGetEdition()

Returns the edition of @RISK.?

RiskGetPercentile(cellRefOrName, inputOrOutput%, simNum&, p#, x#)

Returns the value associated with a specified percentile p from the simulation results for the input or output cellRefOrName.?

RiskGetRegression(cellRefOrName, simNum&, numInputs&, sensInfo() As RiskSensitivityType,r2Value#)

Returns regression sensitivities between the simulation output cellRefOrName and the input distributions in the simulation.

RiskGetSettings(theSettings As RiskSettingsType)

Fills theSettings with the current @RISK settings.?

RiskGetSettingsDefaults(theSettings As RiskSettingsType)

Fills theSettings with the current default @RISK settings.? These are the same settings the user sees if a worksheet is opened without a .RSK file.?

RiskGetStats(cellRefOrName, inputOrOutput%, simNum&, theStats As RiskStatsType)

Fills theStats with the statistics on simulation results for the input or output cellRefOrName.?theStats is a RiskStatsType variable and contains all of the standard statistics for the input or output.

RiskGetTarget(cellRefOrName, inputOrOutput%, simNum&, x#, p#)

Returns a target probability for an x value from the simulation results for the input or output cellRefOrName.?A target probability is the probability of a value less than or equal to the specified x value occurring.

RiskNewSimulation()

Clears the current @RISK simulation data.  The simulation settings, input data and graphs (with supporting fitted datasets) and simulation results (including any generated graphs) currently active in @RISK will be erased and all settings will be restored to defaults.?

RiskOpenSimulation(RSKfilename$)

Opens the current @RISK simulation data in RSKfilename.? The simulation settings, input data and graphs (with supporting fitted datasets) and simulation results (including any generated graphs) included in the .RSK file will then be available in @RISK.?

RiskMakeResultsGraph(cellRef,destRange,graphType,xlFormat, leftdelimiter, rightdelimiter, xMin, xMax, xScale,title,SimNum)

Adds a graph of simulation results to a worksheet.?The graphs generated are the same as generated in the @RISK-Results window. Many arguments to this function are optional. If optional arguments are not entered, RiskMakeResultsGraph creates a graph using the current default settings for any omitted argument.

RiskSaveSimulation(optional RSKfilename$)

Saves the current @RISK simulation data to a .RSK file.?Saved data includes simulation settings, all input data and graphs (with supporting fitted datasets) and simulation results including any generated graphs.?

RiskGetSettings(theSettings As RiskSettingsType)

Makes the @RISK settings equal to the values in theSettings.? The return value of the function is zero if the call was successful.?

RiskSelectFunctions(selectWhat%, findWhere%)

Selects cells containing @RISK functions.

RiskSimulate()

Runs a simulation using the current @RISK simulation settings.



@RISK Macro Public Variables

Type

Variables

RiskSettingsType

NumIterations (Long)
NumSimulations (Integer)
AutoStopPercChange (Double)
UpdateDisplay (Boolean)
PauseOnError (Boolean)
MinimizeOnStart (Boolean)
SamplingType (Integer)
StandardRecalc (Integer)
CollectDistributionSamples (Integer)
UseFixedSeed (Boolean)
FixedSeed (Long)
UseDifferentSeedForEachSim (Boolean)
RunBeforeSimMacro (Boolean)
BeforeSimMacro (String)
RunBeforeRecalcMacro (Boolean)
BeforeRecalcMacro (String)

RunAfterRecalcMacro (Boolean)
AfterRecalcMacro (String)
RunAfterSimMacro (Boolean)
AfterSimMacro (String)
ResultsUpdateFreq (Long)
RealTimeResults (Boolean)
MonitorConvergence (Boolean)
UpdateStatFunctions (Boolean)
StatFunctionsUpdateFreq (Long)
ShowRiskWindowAtEndOfSimulation ( Boolean)
GenerateExcelReportsAtEndOfSimulation (Boolean)
ExcelReportsGoInNewWorkbook (Boolean)
ExcelReportsToGenerate (Long)
TemplateSheetName (String)

RiskStatsType

NumData (Long)
NumErrs (Long)
Min (Double)
Max (Double)
Mean (Double)

Sd (Double)
Var (Double)
Skewness (Double)
Kurtosis (Double)
Mode (Double)

RiskFitType

fitTabName (String)
DataRange (Range
DataType (Integer)
Discrete (Boolean)
DiscreteDataInCountedFormat (Boolean)

NormalizeDensityCurve (Boolean)
FilterMode (Long)
FilterMin (Double)
FilterMax (Double)
FilterStdDevs (Double)
AutoRefit (Boolean)

RiskSensitivityType

inputName (String)
inputRef (String)
coefficient (Double)

RiskScenarioType

inputName (String)
inputRef (String)
actualMedian (Double)
percentileMedian (Double)
ratio (Double)

ÇÊ »çÀÌ¾ð½º¢ß | About Us | Contact Us | °í°´ Á¤º¸ º¸È£ Á¤Ã¥

© 2000 - 2008 Phil Science, Inc. All rights reserved.