Cell Example

The following code demonstrates the three methods of accessing a given cell. This code assumes there is a Data Source named Bobs Video Store on the OLAP server:

Dim cat     As New ADOMD.Catalog
Dim cst     As New ADOMD.Cellset
Dim cll     As ADOMD.Cell
cat.ActiveConnection = "Data Source=Bobs Video Store;Provider=msolap;"
cst.Source = "SELECT [Product Category].MEMBERS ON ROWS, _
                     [Store State].MEMBERS ON COLUMNS _
              FROM   [Bobs Video Store] _
              WHERE  ([Quantity])"
Set cst.ActiveConnection = cat.ActiveConnection
cst.Open
'Retrieve cell using ordinal position
Set cll = cst(10)
'Retrieve cell using axis numerical position
Set cll = cst(2,2)
'Retrieve cell using member names
Set cll = cst("Childrens", "New York State")