CB.SetFore

This function changes forecast attributes without redefining the forecast using CB.DefineForeND.

Before you call this function, the forecast must exist.

Table 180. CB.SetFore Returned Data Type

Returned Value

Returned Data Type

Whether the function was successful

Variant

Table 181. CB.SetFore Parameters

Parameter

VBA Data Type

Value

Description

ForeReference

Variant

In a macro: Range("B3")

Points to the forecast cell with the desired data

Index

Integer

See Table 182

Sets certain forecast attributes, according to Value

Value

Variant

See Table 183

Works with Index to set certain forecast attributes

Table 182, following, describes the Index parameter.

Table 182. CB.SetFore Index Parameter Values — Required, Integer

Named Constant Value

Index Value

Description

cbForName

1

Sets the forecast name, according to Value

cbForUnits

2

Sets the forecast units, according to Value

cbForAutoOpen

4

Changes whether Crystal Ball displays the forecast window automatically, according to Value

cbForOpenWhen

5

Changes when Crystal Ball displays the forecast window, according to Value

cbForPrecision

6

Changes whether Crystal Ball uses precision of the forecast value to stop a simulation, according to Value

cbForPrecisionAbsolute

7

Changes whether Crystal Ball uses absolute or relative terms for the size of the confidence interval, according to Value

cbForPrecisionAbsoluteValue

8

Sets the size of the confidence interval in forecast units, according to Value

cbForPrecisionRelativeValue

9

Sets the size of the confidence interval in percentage terms, according to Value

cbForPrecisionMean

10

Sets whether Crystal Ball uses the precision of the mean as a stopping criterion, according to Value

cbForPrecisionStdDev

11

Sets whether Crystal Ball uses the precision of the standard deviation as a stopping criterion, according to Value

cbForPrecisionPerc

12

Sets whether Crystal Ball uses the precision of a percentile value as a stopping criterion, according to Value

cbForPrecisionPercValue

13

Sets the percentile value that Crystal Ball checks for the indicated precision, according to Value

cbForFilter

14

Sets whether Crystal Ball filters forecast values, according to Value

cbForFilterInside

15

Sets whether discards forecast values inside or outside the indicated range, according to Value

cbForFilterFrom

16

Sets the lower bound of the filtering range, according to Value

cbForFilterTo

17

Sets the upper bound of the filtering range, according to Value

cbForFilterGlobal

18

Specifies whether Crystal Ball applies the filtering options to equivalent trials of all forecasts, according to Value

cbForFrozen

19

Freezes the forecast, according to Value

cbForLSL

20

Enters a lower specification limit for the forecast, according to Value

cbForUSL

21

Enters an upper specification limit for the forecast, according to Value

cbForTarget

22

Enters a target value for the forecast, according to Value

Note:

Index = cbForWindowSize = 3 is obsolete and is not included here.

Table 183, following, describes the Value parameter.

Table 183. CB.SetFore Value Parameter Values — Required, Variant

Used With Specified Values of Index

Value

Description

For Index = 1, cbForName: String

Forecast name, in quotes ("")

Specifies the new forecast name

For Index = 2, cbForUnits: String

Units name, in quotes ("")

Specifies the new units

For Index = 4, cbForAutoOpen: Boolean

True or False

True displays the window automatically. False does not.

For Index = 5, cbForOpenWhen: Integer

0 or 1: cbOpnWhenRunning = 0, cbOpnWhenStopped = 1

Sets when to display the forecast chart: 0 = during the simulation; 1 = after the simulation stops

For Index = 6, cbForPrecision: Boolean

True or False

True turns on precision control. False turns it off.

For Index = 7, cbForPrecisionAbsolute: Boolean

True or False

True sets the confidence interval to be in absolute units. False sets it in relative terms.

For Index = 8, cbForPrecisionAbsoluteValue: Double

Units

Sets the size of the confidence interval in terms of forecast units

For Index = 9, cbForPrecisionRelativeValue: Double

0.01 to 99.99

Sets the size of the confidence interval in (relative) percentage terms

For Index = 10, cbForPrecisionMean: Boolean

True or False

True checks the precision of the mean. False does not.

For Index = 11, cbForPrecisionStdDev: Boolean

True or False

True checks the precision of the standard deviation. False does not.

For Index = 12, cbForPrecisionPerc: Boolean

True or False

True checks the precision of a percentile. False does not.

For Index = 13, cbForPrecisionPercValue: Double

0.01 to 99.99

Sets the percentile value that Crystal Ball checks for precision

For Index = 14, cbForFilter: Boolean

True or False

True turns on forecast filtering. False turns it off.

For Index = 15, cbForFilterInside: Boolean

True or False

True discards values inside the filtering range. False discards values outside the range.

For Index = 16, cbForFilterFrom: Double

Units

Sets the lower bound of the filtering range

For Index = 17, cbForFilterTo: Double

Units

Sets the upper bound of the filtering range

For Index = 18, cbForFilterGlobal: Boolean

True or False

True applies the filtering settings to equivalent trials for all forecasts in a simulation. False applies them only to the current forecast.

For Index = 19, cbForFrozen: Boolean

True or False

True freezes the forecast so it will not recalculate when a simulation runs. False unfreezes the forecast.

For Index = 20, cbForLSL: Variant

A numeric value (double), a string representing a cell reference (such as “=B1”), or cbParmUndefined

Sets the lower specification limit (LSL) for the forecast

For Index = 21, cbForUSL: Variant

A numeric value (double), a string representing a cell reference (such as “=B1”), or cbParmUndefined

Sets the upper specification limit (USL) for the forecast

For Index = 22, cbForTarget: Variant

A numeric value (double), a string representing a cell reference (such as “=B1”), or cbParmUndefined

Sets the target value for the forecast