JoeyMang83
New Member
- Joined
- Dec 17, 2011
- Messages
- 19
Hi All,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
My VBA skills are limited, and I’ve looked far and wide to get some code to emulate to do the following:<o></o>
<o></o>
1. Search the Outlook calendar (for whichever user clicks the Macro button).<o></o>
<o></o>
2. Search [or find] in the “notes” or “body” of a calendar meeting appointment for a particular string (located in cell H2 of the Active.Sheet). If it finds that string in any calendar entry body it will delete any such calendar meetings and send a response to any recipients that were part of that meeting. There may be up to 50 meetings related to this string, so all would need to be deleted from the calendar with auto response being sent to all recipients that it is being cancelled.<o></o>
<o></o>
Sounds pretty simple, but cannot find any solid code for the life of me.<o></o>
<o></o>
I found this thread this web site doing a search, but it doesn’t quite do what I need…
<o></o>
http://www.mrexcel.com/forum/showthread.php?t=564254&highlight=delete+outlook+calendar<o></o>
<o></o>
I also found some code here, but this is not it, and does not do what I’d like it to either.<o></o>
<o></o>
<o></o>
Thank you in advance for your help.<o></o>
<o></o>
My VBA skills are limited, and I’ve looked far and wide to get some code to emulate to do the following:<o></o>
<o></o>
1. Search the Outlook calendar (for whichever user clicks the Macro button).<o></o>
<o></o>
2. Search [or find] in the “notes” or “body” of a calendar meeting appointment for a particular string (located in cell H2 of the Active.Sheet). If it finds that string in any calendar entry body it will delete any such calendar meetings and send a response to any recipients that were part of that meeting. There may be up to 50 meetings related to this string, so all would need to be deleted from the calendar with auto response being sent to all recipients that it is being cancelled.<o></o>
<o></o>
Sounds pretty simple, but cannot find any solid code for the life of me.<o></o>
<o></o>
I found this thread this web site doing a search, but it doesn’t quite do what I need…
<o></o>
http://www.mrexcel.com/forum/showthread.php?t=564254&highlight=delete+outlook+calendar<o></o>
<o></o>
I also found some code here, but this is not it, and does not do what I’d like it to either.<o></o>
<o></o>
Code:
Dim olApp As Outlook.Application<o:p></o:p>
Dim objAppointment As Outlook.AppointmentItem<o:p></o:p>
Dim objAppointments As Outlook.MAPIFolder<o:p></o:p>
Dim objNameSpace As Outlook.NameSpace<o:p></o:p>
Dim objProperty As Outlook.UserProperty<o:p></o:p>
Dim OutlookStartTime, OutlookEndTime As Date<o:p></o:p>
Dim sFilter As Variant<o:p></o:p>
<o:p></o:p>
OutlookStartTime = CDate(AP_Date & " " & AP_Start_Time)<o:p></o:p>
OutlookEndTime = CDate(AP_Date & " " & AP_End_Time)<o:p></o:p>
<o:p></o:p>
Set olApp = CreateObject("Outlook.Application")<o:p></o:p>
Set objNameSpace = olApp.GetNamespace("MAPI")<o:p></o:p>
Set objAppointments = objNameSpace.GetDefaultFolder(olFolderCalendar)<o:p></o:p>
<o:p></o:p>
sFilter = "[Start] = '" & Format(OutlookStartTime, "ddddd h:nn AMPM") & _<o:p></o:p>
"' And [End] = '" & Format(OutlookEndTime, "ddddd h:nn AMPM") & "' " & _<o:p></o:p>
" And [Subject] = '" & Me.AP_With_Whom & " - " & Me.AP_Type & "'"<o:p></o:p>
<o:p></o:p>
Set objAppointment = objAppointments.items.Find(sFilter)<o:p></o:p>
<o:p></o:p>
If Not TypeName(objAppointment) = "Nothing" Then<o:p></o:p>
objAppointment.Delete<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
Set objAppointment = Nothing<o:p></o:p>
Set objAppointments = Nothing<o:p></o:p>
<o:p></o:p>
End Sub<o:p></o:p>
Thank you in advance for your help.<o></o>
Last edited: