With the help of Chat GPT I have been trying to create some macros in Outlook to automate acceptance of incoming meeting requests. The macro is to be applied to a (one) meeting request while it's selected in the inbox. I want to:
Accept the meeting / decline / accept tentatively (defining the 'Show as' aspect of the calendar item)
With/without response to the organiser (I don't need 'respond with remarks' for my purpose)
Assign a category to the calendar item
Delete the invitation from my inbox
For sake of clarity: I will be making separate macros for my most used options. So I don't need the macro to include pop-up boxes asking me for input. Just one macro for one particular set of possible options.
I'm using Outlook 'Microsoft 365 Apps for enterprise'. Version 2208.
I've tried a couple of suggestions from Chat GPT, and I finally have this macro:
Sub AcceptPrivateNoReply()
Dim objItem As Object
Dim objMeeting As MeetingItem
If Application.ActiveExplorer.Selection.Count = 1 Then 'Make sure only one item is selected
Set objItem = Application.ActiveExplorer.Selection.Item(1)
If TypeOf objItem Is MeetingItem Then 'Make sure the selected item is a meeting
Set objMeeting = objItem
objMeetingStatus = olMeetingAccepted
objMeeting.Categories = "Privé" 'Assign category to the meeting
objMeeting.Delete
MsgBox "Private appt accepted w/o reply.", vbInformation, "Meeting Accepted"
Else
MsgBox "Please select a meeting item.", vbExclamation, "No Meeting Item Selected"
End If
Else
MsgBox "Please select only one meeting item.", vbExclamation, "Multiple Items Selected"
End If
End Sub
Part of the macro works:
the invitation is visible in the calendar with the private category
the request is deleted from my inbox
However, the meeting is no actually accepted (so obviously also no reply to the sender). The item is visible in the calendar, but it shows the 'Tentative border' and I can't change it, because the 'show as' option in the right-click menu is greyed out. Which is logical, as the request was actually neither accepted nor declined.
This line - although not triggering an error - obviously doesn't work.
objMeetingStatus = olMeetingAccepted
I've been spending quite some time with ChatGPT to get alternatives for the various lines, but they either triggered errors or didn't do anything.
So the bottom line: is it possible - and what lines do I use - to incorporate the activity to 'accept/decline/tentative with/without a response' into a macro.
I also put this question into learn.microsoft.com, but didn't get any responses for a while now. I turned to Stackoverflow following a suggestion on another learn page.