I’m interested in taking a meeting request (Outlook 2007 SP2) that is sent to me and modifying the Category as well as modifying the item from Busy to Free. I wrote some code that can do that very thing, but I have to first accept the meeting request, go find the meeting in the calendar, double click it and then, with that item in focus, I can run the script below.
Is there any way I can modify this so instead of clicking the “Accept” button from the original meeting request, I could click a button to run some code that would accept the meeting, find the meeting and make the modifications?
Any help appreciated.
Sub ModifyAppt()
On Error GoTo Err_ModifyAppt
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim myItem As Object
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myInbox.Items
Set myItem = Application.ActiveInspector.CurrentItem
myItem.ReminderSet = False
myItem.Categories = "Personal"
myItem.BusyStatus = 0
myItem.Save
Dim SaveMode As OlInspectorClose
myItem.Close (SaveMode)
Exit_ModifyAppt:
Exit Sub
Err_ModifyAppt:
MsgBox "sub ModifyAppt " & Err.Description
Resume Exit_ModifyAppt
End Sub
Is there any way I can modify this so instead of clicking the “Accept” button from the original meeting request, I could click a button to run some code that would accept the meeting, find the meeting and make the modifications?
Any help appreciated.
Sub ModifyAppt()
On Error GoTo Err_ModifyAppt
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim myItems As Outlook.Items
Dim myItem As Object
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myInbox.Items
Set myItem = Application.ActiveInspector.CurrentItem
myItem.ReminderSet = False
myItem.Categories = "Personal"
myItem.BusyStatus = 0
myItem.Save
Dim SaveMode As OlInspectorClose
myItem.Close (SaveMode)
Exit_ModifyAppt:
Exit Sub
Err_ModifyAppt:
MsgBox "sub ModifyAppt " & Err.Description
Resume Exit_ModifyAppt
End Sub