PDA

View Full Version : [SOLVED:] Ouklook email format



JonMcK
07-09-2015, 02:45 AM
Hi,

I have this code that checks emails and removes a specific word, however if the word is found and removed the entire email loses it's format. Can anyone help and let me know how to retain the original message format.

Thanks

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim Insp As Inspector
Dim obj As Object
Set Insp = Application.ActiveInspector
Set obj = Insp.CurrentItem
obj.Body = Replace(obj.Body, "E_B_L_O_C_K", "")
End Sub

skatonni
07-09-2015, 09:43 AM
You pass item. There is no need to use obj. But that is not the problem.

Try this:

Private Sub Application_ItemSend(ByVal Item As Object, cancel As Boolean)
Item.HTMLBody = Replace(Item.HTMLBody, "E_B_L_O_C_K", "")
End Sub

JonMcK
07-10-2015, 01:29 AM
You pass item. There is no need to use obj. But that is not the problem.

Try this:

Private Sub Application_ItemSend(ByVal Item As Object, cancel As Boolean)
Item.HTMLBody = Replace(Item.HTMLBody, "E_B_L_O_C_K", "")
End Sub


Thank you so much, this works a treat and tidies the code up, very much appreciated.