Consulting

Results 1 to 3 of 3

Thread: Ouklook email format

  1. #1
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    5
    Location

    Ouklook email format

    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

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    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
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    VBAX Newbie
    Joined
    Jul 2015
    Posts
    5
    Location

    Works a treat!

    Quote Originally Posted by skatonni View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •