Hi,
Problem !
Retrieving Appointment Information for a Given Time Frame
in outlook:
Next code works, only the program doen't find 'repeated appointments '. Does someone nows the solution ?
Thanks,
De Klerck Jurgen
[email protected]
You can use the Find method on an Items collection to locate those items that match a specific criteria. The following example shows you how to locate AppointmentItems with a Start date of 2/25/97. The criteria for the Find method is:
[Start] >= "2/25/97 12:00 AM" and [Start] <= "2/25/97 11:59 PM"
With the Find method, the first item matching the criteria is returned. To find subsequent matches, you must use the FindNext method. FindNext will return Nothing when no more matches are found:
Sub GetAppointments()
Dim objOutlook As New Outlook.Application
Dim objNS As NameSpace
Dim Appt As Object
Dim objInboxItems As Items
Dim Criteria as String
Set objNS = objOutlook.GetNamespace("MAPI")
Set objInboxItems = _
objNS.GetDefaultFolder(olFolderCalendar).Items 'Get all items
'in Calendar folder
Criteria = "[Start]>=""2/25/97 12:00 AM"" " & _
"and [Start]<= ""2/25/97 11:59 PM""" 'Criteria for Find
'method
Set Appt = objInboxItems.Find(Criteria) 'Find first Appointment
'matching the criteria
Do While Not(Appt Is Nothing) 'Loop until no match
Debug.Print Appt.Start; Appt.End; Appt.Subject 'Print the
'Appointment Start,
'End, and Subject
Set Appt = objInboxItems.FindNext 'Find the next
'Appointment matching
'the same criteria
'used with the Find
'method
Loop
Set Appt = Nothing
Set objInboxItems = Nothing
Set objNS = Nothing
Set objOutlook = Nothing
End Sub
Adding a New Contact
