' Appointment Item is known and is UNIQUE.
Set mobjOLA = CreateObject("Outlook.Application")
Set mobjNS = mobjOLA.GetNamespace("MAPI")
mobjNS.Logon , , False, False
Set mobjFLDR = mobjNS.GetDefaultFolder(olFolderCalendar)
On Error Resume Next
Set mobjAPPT = mobjFLDR.Items(strMileage)
If Err.Number <> 0 Then GoTo CannotFindObject
mobjAPPT.Delete
Andi Saputra
I did not know you could use this:
to get your AppointmentItem.Set mobjAPPT = mobjFLDR.Items(strMileage)
Using something like the mileage field is ok and used by many. But to find it I think you might need to use the "Find" function of Outlook. The following is added after you have your Calendar folder.
Code:
sFilter = "[Mileage] = " & appID & ""
If Not mobjFLDR Is Nothing Then
Set mobjAPPT = mobjFLDR.Items.Find(sFilter)