Created
June 20, 2018 14:51
-
-
Save fwojciec/824a62354766bf984a9a645f4b2cf7db to your computer and use it in GitHub Desktop.
RemoveAttachments
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 RemoveAttachments() | |
Dim objSelection As Outlook.Selection | |
Dim i, n As Long | |
Dim objMail As Outlook.MailItem | |
Dim objAttachment As Outlook.Attachment | |
'Get the selected emails | |
Set objSelection = Outlook.Application.ActiveExplorer.Selection | |
'Process each email one by one | |
For i = objSelection.Count To 1 Step -1 | |
If TypeOf objSelection(i) Is MailItem Then | |
Set objMail = objSelection(i) | |
If objMail.Attachments.Count > 0 Then | |
For n = objMail.Attachments.Count To 1 Step -1 | |
Set objAttachment = objMail.Attachments.Item(n) | |
objAttachment.Delete | |
Next | |
objMail.Save | |
End If | |
End If | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Microsoft Outlook Macro -- removes all attachments from all selected emails.
Adapted from: https://www.datanumen.com/blogs/batch-remove-specific-type-attachments-multiple-outlook-emails/