Outlook Script to edit subject


In Outlook, can I edit the subject line of incoming mail from a specific sender to keep only the third word of the subject line that is 5 words long? The 3rd word is unique to each email sent, the remaining text is always the same.

Best Answer

This is very easy. Just create VBA macro (ALT+F11 in your Outlook and add the following code to your ThisOutlookSession) that looks like this :

Sub EditSubject(Item As Outlook.MailItem)
    Splitted = Split(Item.Subject)
    If UBound(Splitted) == 4 Then
        Item.Subject = Splitted(2)
    End If
End Sub

After that create an Outlook Rule for that particular sender which runs this script.