Remove text to Clean Up

Status
Not open for further replies.

jomili

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
I get hundreds of emails per day, many of them back and forth between groups of people. so I frequently use Outlook 2013's Clean Up tool to wipe out all the individual emails and just keep the gist of the conversation. However, our IT department has just added a wrinkle that I can't find a way around.

Many of the emails come from people outside my organization. For each of those letters our IT department is adding a red-bordered box surrounding red text which reads "WARNING: This email is from outside the Company system. Do not click on links or attachments unless you expect them from the sender and know the content is safe."

So now, when there are back and forth emails, some of the replies have this message in each letter, some have it in only 1 or letters in the chain, etc. So, the Clean Up tool looks at these as different conversations and won't clean them up.

I'd like a way to automatically strip out that text when the email comes in. I tried using the code below, which works on an open email, but it fell far short of what I need. The email was in HTML and after running the code all pictures and content were replaced by URL. Also, I'd rather have something that could strip it out when the letter comes in rather, than trying to clean each one by hand. I'm comfortable with VBA for Excel, not very familiar with VBA for Outlook, so 'd appreciate any help I could get.
Code:
Sub RemoveExpression()

Dim Insp As Inspector
Dim obj As Object

    Set Insp = Application.ActiveInspector
    Set obj = Insp.CurrentItem

    obj.Body = Replace(obj.Body, "WARNING: This email is from outside the Company system. Do not click on links or attachments unless you expect them from the sender and know the content is safe.", "")

    Set obj = Nothing
    Set Insp = Nothing
    
End Sub
 
You need to use a run a script rule and use htmlbody. obj.htmlBody = Replace(obj.htmlBody
if you get both html and plain text, you'll need to test for the format and use either obj.body or obj.htmlbody

See Outlook's Rules and Alerts: Run a Script for more information and links to additional samples. .
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
N How to remove signature formatting from Text in Word (accidentally taken from Outlook) Using Outlook 0
D Remove text in subject using VBA Outlook VBA and Custom Forms 4
F VB Script, remove text from subject line when forwarding Using Outlook 22
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 2
G Reply a selected message and remove blank space before signature Outlook 365 version 2406 64BIT Outlook VBA and Custom Forms 0
D Auto Remove [EXTERNAL] from Subject + ConversationTopic (WITHOUT Redemption plug-in) Outlook VBA and Custom Forms 5
Rupert Dragwater How do I remove an email ending with @gmail.com Using Outlook 4
E Edit incoming emails to remove a certain sentence added by the "system" Using Outlook 1
O VBA - Regex - remove double line spacing Outlook VBA and Custom Forms 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
Rupert Dragwater How to permanently remove an email address Using Outlook 9
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
E Remove flag automatically Using Outlook 4
N Can't create NEW GROUP and add/remove a member from existing Group in Outlook Using Outlook 1
Timmon Remove just one attachment before AutoForward Outlook VBA and Custom Forms 0
Z Remove GMAIL IMAP account from Outlook 2016 Using Outlook 2
C-S-R Manage Add-ins (Remove Wunderlist) Using Outlook 6
O Remove duplicates within two accounts Using Outlook 2
D How to remove a folder, option grayed out Using Outlook 4
T Outlook 2016 remove envelope icon for certain folders Using Outlook 5
M In Outlook Calendar remove the buttons: 'Today' and '<' (Back a day) and '>' (Forward a day) that are below the Ribbon and above the calendar display. Using Outlook 0
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 16
P Add, remove, & reorder folder pane Using Outlook 6
W Remove specific contacts from contact list Outlook VBA and Custom Forms 3
T Cannot remove needless PST Using Outlook 1
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
S Unable to remove rule outlook 2010 Using Outlook 0
B Remove Subject Residual Outlook VBA and Custom Forms 3
P how to remove unwanted PST file default categories assigned to many calendar entries Using Outlook 7
B Automatically Forward Emails and Remove/Replace All or Part of Body Outlook VBA and Custom Forms 8
T Remove Old Location From Tasks Pane Using Outlook 1
A remove or turn off outlook.com contact folder from outlook 2016 Using Outlook 4
R Chancing / remove “ something ” in the subject, online archive Outlook VBA and Custom Forms 8
Morgan Fowler Remove Signature Using Outlook 1
M How to remove a list of specific contacts from Outlook Using Outlook 18
R New Links on Navigation Pane, How to Remove? Using Outlook 1
M VBA to remove deferred delivery on a MeetingItem Outlook VBA and Custom Forms 2
J Remove extra line above signature in reply Outlook VBA and Custom Forms 5
Diane Poremsky How to Remove RSS Support from Outlook Using Outlook 0
Diane Poremsky Remove Attachments From Messages Using Outlook 0
Diane Poremsky Remove Office 2013 Update Banner Using Outlook 0
O Remove duplicate mail items Outlook VBA and Custom Forms 6
Diane Poremsky Remove a password from an Outlook *.pst File Using Outlook 3
G VBA/Macro to remove page colour when replying or forwarding email Outlook VBA and Custom Forms 2
L Fake reminder apperaring (not in calendar) - how to remove? Using Outlook 5
J Your IMAP server wants to alert you to the following: cannot remove system folder Using Outlook 3
A Auto Insert of filename when selecting 'Remove Attachment' Using Outlook 1
C how to remove icons on right hand side outlook 2013 Using Outlook 2
K Remove Manage APPS button for users Exchange Server Administration 1
P Remove name and parenthses from email Using Outlook 1

Similar threads

Back
Top