jkhvbid
05-15-2018, 09:03 AM
I would like to add a string to the subject of a selected email and have it saved.
The code I have right now works to a point. I click on the target email, run the
macro and the subject is changed but I have to open the email and save it
for it to work.
Sub ChangeSubject()
Dim strSubject As String
Dim olMail As MailItem
On Error GoTo ErrHandler
Set olMail = Application.ActiveExplorer.Selection.Item(1)
strSubject = olMail.Subject
olMail.Subject = "(TEST) " & strSubject
Exit Sub
ErrHandler:
Beep
End Sub
The code I have right now works to a point. I click on the target email, run the
macro and the subject is changed but I have to open the email and save it
for it to work.
Sub ChangeSubject()
Dim strSubject As String
Dim olMail As MailItem
On Error GoTo ErrHandler
Set olMail = Application.ActiveExplorer.Selection.Item(1)
strSubject = olMail.Subject
olMail.Subject = "(TEST) " & strSubject
Exit Sub
ErrHandler:
Beep
End Sub