HypExecuteQuery

Data source types: Essbase

Description

HypExecuteQuery() executes an MDX query and displays the results on a worksheet. (If you do not want to display the query results on a worksheet, use HypExecuteMDXEx instead.)

Syntax

HypExecuteQuery (ByVal vtSheetName As Variant, ByVal vtMDXQuery As Variant) As Long

ByVal vtSheetName As Variant

ByVal vtMDXQuery

Parameters

vtSheetName: For future use. Currently the active sheet is used.

vtMDXQuery: The MDX query statement to be executed on the worksheet.

Return Value

Long. If successful, return value is 0; otherwise, returns the appropriate error code.

Example

Declare Function HypExecuteQuery Lib "HsAddin" (ByVal vtSheetName As Variant, ByVal vtMDXQuery As Variant) As Long

Sub Sample_HypExecuteQuery ()
   Dim vtQuery As Variant
   vtQuery = "SELECT {([Jan])} on COLUMNS, {([East])} on ROWS from 
                 Sample.Basic"
   sts = HypConnect (Empty, "system", "password", "Sample_Basic")
   sts = HypExecuteQuery (Empty, vtQuery)
   sts = HypDisconnect (Empty, True)
End sub