Retrieve data from Calendar : Exchange ADO « PowerPoint « VBA / Excel / Access / Word






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

 








Related examples in the same category