I have a rule running on incoming mail that moves items with a certain string in their subject line to a folder. It then runs a script to replace part of the subject with something else.
I've put break points in the script to make sure it's running and not a macro security issue. It reads the subject but just won't save the change. I got the script from someone looking for a similar result
Sub RunAScriptRuleRoutine(MyMail As Outlook.MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
olMail.Subject = Replace(objMail.Subject, "[Jira]", "something else")
olMail.Save
Set olMail = Nothing
Set olNS = Nothing
End Sub
I know the above is overkill, so I've also checked it with much simpler code but still no success, it just keeps the same subject line that it came in with.
Public Sub Whatever(Mail As Outlook.MailItem)
Mail.Subject = "Hello"
Mail.Save
End Sub
It seems like I'm misunderstanding the MailItem.Save Method but I can't work it out.
I'm using Outlook 2007.
Any Ideas?