I am trying to add a custom action to a rule in Outlook where a message is automatically forwarded and the attachment stays but the original body message is deleted.
I need to write code for the 'clear contents' part. So far have this:
Public Sub MyMacro(msg As MailItem)
Dim strID As String
Dim olNS As NameSpace
Dim olMail As MailItem
strID = msg.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
With olMail.HTMLBody = " "
End With
Set olMail = Nothing
Set olNS = Nothing
End Function
after the .HTMLBody I can't get it to delete anything.
Edit: Added the actual requirement hidden in the comment. "I need the original e-mail contents deleted including who its from. Basically so that it looks like a brand new e-mail."