Data source types: Essbase, Planning, Financial Management, Hyperion Enterprise
HypConnected() provides the connection status of the sheet. A true value indicates that the sheet is connected to a provider; a false value indicates that the sheet is not connected.
Declare Function HypConnected Lib "HsAddin" (ByVal vtSheetName As Variant) As Variant Sub Sample_HypConnected Dim X as Variant X = HypConnected(Empty) End sub
If the sheet is connected, a variant with a value of -1 is returned, which is interpreted as True by VBA. In order to get -1 as the return value, you must declare the variable (which takes a return value) as a number type (Long, Integer, Double, etc.). The script given below demonstrates this:
Dim X as Integer 'Can also be Long or Double
X = HypConnected (Empty) 'Value of X will become -1
'if Sheet1 is connectedIf variable X is not defined, VBA interprets it (and any other variable which is not defined) as being of the type, Variant. Then, if Sheet1 is connected, X will be equal to True.
If variable X is defined as Variant, the return value is correctly displayed as True.