Data provider types: Oracle Essbase, Oracle Hyperion Planning, Oracle Hyperion Financial Management
HypConnected() provides the connection status of the sheet.
ByVal vtSheetName As Variant
vtSheetName: The name of worksheet on which to run the function. If vtSheetName is
Empty, the active worksheet is used.
Returns True if the sheet is connected to a provider; False if it is not.
Declare Function HypConnected Lib "HsAddin" (ByVal vtSheetName As Variant) As Variant Sub Example_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:
Declare Function HypConnected Lib "HsAddin" (ByVal vtSheetName As Variant) As Variant Sub Example_HypConnected() Dim X As Integer 'Can also be Long or Double X = HypConnected(Empty) 'Value of X will become -1 if Sheet1 is connected End Sub
If 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 a boolean, the return value is correctly displayed as True.