Hey Everyone!!
I'm hoping I can get a little help with this macro. It's for Outlook... but I know you are all experts with macros.
I made a macro (pieced together from various google sources) that will insert TEXT at the start of an email subject line when I send, reply, reply all, or forward an email. If the subject line already contains TEXT then it will send the subject line as is. What I would like to add in is if the subject line starts with "// " then the email would send the subject line less the // .
Example -
Subject: This is an email --> Subject: TEXT This is an email
Subject: TEXT This is an email --> Subject: TEXT This is an email
Subject: // This is an email --> Subject: This is an email
I thought I had it all put together; however when replying or forwarding an email it would send a subject like "Subject: TEXT FW: TEXT This is an email" and I don't want it to keep tacking on the TEXT every time I reply/forward.
Can anyone help me out with this? Below is the macro I have right now.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim subject_line As String
subject_line = Trim(Item.Subject)
If InStr(1, UCase(subject_line), "TEXT ") <> 1 Then
Item.Subject = "TEXT " & subject_line
Else
Item.Subject = subject_line
End If
End Sub
Thanks!!
I'm hoping I can get a little help with this macro. It's for Outlook... but I know you are all experts with macros.
I made a macro (pieced together from various google sources) that will insert TEXT at the start of an email subject line when I send, reply, reply all, or forward an email. If the subject line already contains TEXT then it will send the subject line as is. What I would like to add in is if the subject line starts with "// " then the email would send the subject line less the // .
Example -
Subject: This is an email --> Subject: TEXT This is an email
Subject: TEXT This is an email --> Subject: TEXT This is an email
Subject: // This is an email --> Subject: This is an email
I thought I had it all put together; however when replying or forwarding an email it would send a subject like "Subject: TEXT FW: TEXT This is an email" and I don't want it to keep tacking on the TEXT every time I reply/forward.
Can anyone help me out with this? Below is the macro I have right now.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim subject_line As String
subject_line = Trim(Item.Subject)
If InStr(1, UCase(subject_line), "TEXT ") <> 1 Then
Item.Subject = "TEXT " & subject_line
Else
Item.Subject = subject_line
End If
End Sub
Thanks!!