Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. Sub ConvertToPlain(MyMail As MailItem)
  2. Dim strID As String
  3. Dim objMail As Outlook.MailItem
  4.  
  5. strID = MyMail.EntryID
  6. Set objMail = Application.Session.GetItemFromID(strID)
  7. objMail.BodyFormat = olFormatPlain
  8. objMail.Save
  9.  
  10. Set objMail = Nothing
  11. End Sub
  12.  
  13. Sub RemoveAttachments()
  14. Dim myAttachment As Attachment
  15. Dim myAttachments As Attachments
  16. Dim selItems As Selection
  17. Dim myItem As Object
  18. Dim lngAttachmentCount As Long
  19.  
  20. ' Set reference to the Selection.
  21. Set selItems = ActiveExplorer.Selection
  22.  
  23. ' Loop though each item in the selection.
  24. For Each myItem In selItems
  25. Set myAttachments = myItem.Attachments
  26.  
  27. lngAttachmentCount = myAttachments.Count
  28.  
  29. ' Loop through attachments until attachment count = 0.
  30. While lngAttachmentCount > 0
  31. myAttachments(1).Delete
  32. lngAttachmentCount = myAttachments.Count
  33. Wend
  34.  
  35. myItem.Save
  36. Next
  37.  
  38. MsgBox "All Done. Attachments were removed.", vbOKOnly, "Message"
  39.  
  40. Set myAttachment = Nothing
  41. Set myAttachments = Nothing
  42. Set selItems = Nothing
  43. Set myItem = Nothing
  44. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement