VBA/Excel/Access/Word/PowerPoint/Exchange ADO — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:46, 26 мая 2010
Retrieve data from Calendar
Sub RetrieveCalendar()
Dim strConnection As String
Dim cnConn As ADODB.Connection
Dim rsCalendar As ADODB.Recordset
Set cnConn = New ADODB.Connection
Set rsCalendar = New ADODB.Recordset
With cnConn
.Provider = "Microsoft.JET.OLEDB.4.0"
.ConnectionString = "Exchange 4.0;" _
& "MAPILEVEL=Mailbox - G, D|;" _
& "PROFILE=DMG;" _
& "TABLETYPE=0;DATABASE=C:\;"
.Open
End With
With rsCalendar
.Open "Select * from Calendar", cnConn, adOpenStatic, adLockReadOnly
Do While Not rsCalendar.EOF
Debug.Print rsCalendar(3).Name & ": " & rsCalendar(3).Value
Debug.Print rsCalendar(10).Name & ": " & rsCalendar(10).Value
Debug.Print vbCrLf
rsCalendar.MoveNext
Loop
.Close
End With
Set rsCalendar = Nothing
cnConn.Close
Set cnConn = Nothing
End Sub