I have looked at this Outlook script example, which is similar and a great start for me: Outlook Script to edit subject
However, I am in need to change incoming message subject lines on arrival in a more difficult method which requires more complex string manipulation.
This is actually my base code I've used, which worked up to date:
Sub ConvertToPlain(MyMail As MailItem)
Dim strID As String
Dim objMail As Outlook.MailItem
strID = MyMail.EntryID
Set objMail = Application.Session.GetItemFromID(strID)
objMail.Subject = Left(objMail.Subject, 18)
objMail.Save
Set objMail = Nothing
End Sub
Now, I the original subjects are always in the following format (anything in brackets is a variable):
Ticket [#] - [SOMETHING] - [SOMETHING] - [TITLE]
I wish to remove the "[SOMETHING] - [SOMETHING] -" which is dynamically changing as you can see, and keep only:
Ticket [#] - [TITLE]
In this way, I can once again sort/filter with ease in outlook. How can this be accomplished in VBA? Thank you.