VBA/Excel/Access/Word/Access/ADOMD — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:33, 26 мая 2010
A Basic Example Using ADOMD
Sub BasicQueryExampleII()
Dim cst As ADOMD.Cellset
Dim cat As ADOMD.Catalog
Dim sMDX As String
Dim ws As Worksheet
On Error GoTo ErrHandler
Set ws = ThisWorkbook.Worksheets(2)
sMDX = "SELECT { [Measures].[Units Shipped], " & _
"[Measures].[Units Ordered] } on columns, " & _
"NON EMPTY [Store].[Store City].members on rows " & _
"from Warehouse"
Set cat = New ADOMD.Catalog
cat.ActiveConnection = "Data Source=localhost;Initial Catalog=FoodMart 2000;Provider=msolap;"
Set cst = New ADOMD.Cellset
cst.Open sMDX, cat.ActiveConnection
cst.Close
ExitPoint:
Set cat = Nothing
Set cst = Nothing
Set ws = Nothing
Exit Sub
ErrHandler:
MsgBox "An error occured - " & Err.Description, vbOKOnly
Resume ExitPoint
End Sub