Created
June 7, 2023 09:18
-
-
Save andreasbotsikas/52f4d38dfbf70dea23e66d1af826e3af to your computer and use it in GitHub Desktop.
Macro to move meeting responses in outlook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Move_calendar_responses() | |
Dim objOutlook As Outlook.Application | |
Dim objNamespace As Outlook.NameSpace | |
Dim objInboxFolder As Outlook.MAPIFolder | |
Dim objDestFolder As Outlook.MAPIFolder | |
Set objOutlook = Application | |
Set objNamespace = objOutlook.GetNamespace("MAPI") | |
Set objInboxFolder = objNamespace.GetDefaultFolder(olFolderInbox) | |
Set Folders = Session.GetDefaultFolder(olFolderInbox).Folders | |
Set objDestFolder = Folders.Item("MeetingResponses") | |
' Loop through the items in the folder. Do this backwards | |
' because we are moving items to a different folder. | |
For intCount = objInboxFolder.Items.Count To 1 Step -1 | |
' The email in the specific index | |
Set objEmail = objInboxFolder.Items.Item(intCount) | |
' Allow the system to process. (Helps you to cancel the | |
' macro, or continue to use Outlook in the background.) | |
DoEvents | |
' If the email is a meeting response, move it. | |
If InStr(1, UCase(objEmail.MessageClass), UCase("IPM.Schedule.Meeting.Resp")) Then | |
objEmail.Move objDestFolder | |
End If | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment