EssVRetrieve

Description

Retrieves data from the database and specifies locking behavior.

Syntax

EssVRetrieve(sheetName, range, lockFlag)
ByVal sheetName As Variant
ByVal range As Variant
ByVal lockFlag As Variant

Parameters

sheetName

Text name of worksheet to operate on. sheetName is of the form "[Book.xls]Sheet". If sheetName is Null or Empty, the active worksheet is used.

range

Range object which refers to the data to be used as the source of the retrieve. If range is Null or Empty, the whole worksheet is used. Usually, specifying Null is the best way to update the data in the worksheet. To specify a range in a formatted worksheet, however, range must be a combination of contiguous cells containing member names and data. Or you can specify a blank range of cells for Essbase to fill. The range you specify should be big enough to display all values returned.

lockFlag

Number indicating whether blocks should be locked. Table 14 indicates the lockFlag values and their actions.

Table 14. lockFlag Values and Actions

lockFlagAction

1

Retrieves data and does not lock cells.

2

Locks the affected cells in the database and retrieves data.

3

Locks the affected cells in the database and does not retrieve data.

If lockFlag is Null or Empty, 1 is used.

Return Value

Returns 0 if successful. A negative number indicates a local failure (see VBA Return Values). A return value greater than zero indicates a failure on the server.

Example

Declare Function EssVRetrieve Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal range As Variant, ByVal lockFlag As Variant) As Long

Sub RetData()
X=EssVRetrieve("[Book2.xls]Sheet1", RANGE("A1:F12"), 1)
If X = 0 Then
   MsgBox("Retrieve successful.")
Else
   MsgBox("Retrieve failed.")
End If
End Sub

Note:

See EssVSendData for another example of EssVRetrieve.