I've written something that quickly changes an email subject to add the sender initials, so that I can click it before I add it to a JIRA issue using the Outlook JIRA plugin.
Currently, this is mildly annoying because it has to open the message to change the subject of the email and then when it returns, it moves onto the next message. This adds the mild inconvenience of having to make me move back to the correct message.
I'd be grateful for help figuring out how to make it return to the correct message. Maybe with MailItem.EntryID but I can't figure out how to point to it on close.
Sub EditSubject()
Dim Item As Outlook.MailItem
Dim oInspector As Inspector
Dim strSubject As String
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
Set Item = Application.ActiveExplorer.Selection.Item(1)
Item.Display 'Force the pop-up
Set oInspector = Application.ActiveInspector 'Reassign oInpsector and Item again
Set Item = oInspector.CurrentItem
Else
Set Item = oInspector.CurrentItem
End If
Dim Initials As String
strSubject = Item.Subject
Dim splitName() As String
splitName = Split(Item.SenderName, ",")
Initials = Left$(splitName(1), 2)
Initials = Right$(Initials, 1) + Left$(splitName(0), 1)
Item.Subject = UCase$(Initials) & " - " & strSubject
Item.Close (olSave)
Set Item = Nothing
Set oInspector = Nothing
End Sub
References: [1] Saving emails with sender's initials