Guest User

Untitled

a guest
Jun 21st, 2018
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Sub RemoveAttachments()
  2. Dim objSelection As Outlook.Selection
  3. Dim i, n As Long
  4. Dim objMail As Outlook.MailItem
  5. Dim objAttachment As Outlook.Attachment
  6.  
  7. 'Get the selected emails
  8. Set objSelection = Outlook.Application.ActiveExplorer.Selection
  9.  
  10. 'Process each email one by one
  11. For i = objSelection.Count To 1 Step -1
  12. If TypeOf objSelection(i) Is MailItem Then
  13. Set objMail = objSelection(i)
  14. If objMail.Attachments.Count > 0 Then
  15. For n = objMail.Attachments.Count To 1 Step -1
  16. Set objAttachment = objMail.Attachments.Item(n)
  17. objAttachment.Delete
  18. Next
  19. objMail.Save
  20. End If
  21. End If
  22. Next i
  23. End Sub
Add Comment
Please, Sign In to add comment