Change subject for new e-mails only.

Status
Not open for further replies.

sjmo2

New Member
Outlook version
Outlook 365 64 bit
Email Account
POP3
Hi!

I have written a VBA script that counts the number of words in the e-mail body and adds the word count to the subject. The problem is that this fires for all e-mails: Replies, Reply All, Forward and New. I would like this to fire ONLY for new e-mails.

Thanks
 
Check the subject line for RE: or FW: ? That would be the easiest, as long as people don't compose new email you with a subject of "re: our call" (I'm guilty of that now and again.)

Looking for more than one message id in the header will also work - but some mail clients remove the message id.

I'd guess the false positive rate would be able the same either way... and checking the subject will be the fastest / most efficient.

For incoming mail using a rule -
If left(oItem.subject, 4) = "RE: " or left(oItem.subject, 4) = "FW: " then
Exit sub
End if


if you run the macro manually on all messages -

If left(oItem.subject, 4) = "RE: " or left(oItem.subject, 4) = "FW: " then

next oItem

Else

'your code


End if
 
Check the subject line for RE: or FW: ? That would be the easiest, as long as people don't compose new email you with a subject of "re: our call" (I'm guilty of that now and again.)

Looking for more than one message id in the header will also work - but some mail clients remove the message id.

I'd guess the false positive rate would be able the same either way... and checking the subject will be the fastest / most efficient.

For incoming mail using a rule -
If left(oItem.subject, 4) = "RE: " or left(oItem.subject, 4) = "FW: " then
Exit sub
End if


if you run the macro manually on all messages -

If left(oItem.subject, 4) = "RE: " or left(oItem.subject, 4) = "FW: " then

next oItem

Else

'your code


End if
Thank you Diane. I wasn't sure if there is a consistent way to check if the e-mail draft, upon writing or sending is New or a Reply. This however works well and accomplishes the task at hand!
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Change Subject of 500 mails sitting in Outbox with Macro Using Outlook 6
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
C Change Subject Line in Selected Emails Outlook VBA and Custom Forms 1
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
I change subject and forward without FW: Outlook VBA and Custom Forms 4
J Auto Forward - Include Attachment and change Subject depending on original sender Outlook VBA and Custom Forms 3
E Button to change subject Outlook VBA and Custom Forms 1
Aussie I Change the Subject Line ... but after it is moved the subject has reverted Using Outlook 1
P Subject change on selected emails Outlook VBA and Custom Forms 14
A Change a subject after I hit send Using Outlook 1
F VBA Code to change subject Like Outlook VBA and Custom Forms 3
P Automatically 'Reply to all', and Change the Subject of Email - Diane P help! Using Outlook 0
A Change subject line of external software using outlook. Using Outlook 1
V rule to Find some words in the subject, change subject then forward Using Outlook 1
M rule to change subject, pull email addresses from body, and forward with templ Using Outlook 14
L Script to: Change subject of email after checking body Using Outlook 2
J Change the subject line of messages in public folders Using Outlook 3
J Public folders woes (script to change subject line of messages) Exchange Server Administration 0
M Change font of from/to/subject block Using Outlook 1
M Use Macro to change account settings Outlook VBA and Custom Forms 0
D Unable to change AppointmentItem.Start property Outlook VBA and Custom Forms 4
Horsepower Contact phone numbers randomly change Using Outlook 0
P Outlook 2016 Change Paste Special Default Format Using Outlook 8
whizzard Change FROM address based on TO or CC address Outlook VBA and Custom Forms 8
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
V Can one change the formatting of email title blocks? Using Outlook 0
S Unable to change Message Class Outlook VBA and Custom Forms 0
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
C Outlook 365 Can you change the follow up colour? Using Outlook 1
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
E Outlook VBA change GetDefaultFolder dynamically Outlook VBA and Custom Forms 6
O What would be the recommended way to change an email address (family member)? Using Outlook 0
S Change "This Week" flag start date behavior Using Outlook 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
D Change Microsoft Account password - what to do to update on all devices Using Outlook 4
S Outlook 2016 Change how Outlook shows me contacts in emails Using Outlook 0
Witzker HowTo Change message Class of contact form Outlook VBA and Custom Forms 0
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
Witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R How to Change Margins In Google Docs...? Using Outlook 0
e_a_g_l_e_p_i Outlook 2010 How can I change the font size on right side appointment pane Using Outlook 12
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
D Change senders title Using Outlook 1
W Recurrence: delete older occurrences / change earliest start time Outlook VBA and Custom Forms 0
E Change sending account depending on Subjectline Outlook VBA and Custom Forms 0
J Outlook 2013 Change color of text in data fields of contacts in Outlook 2013? Using Outlook 10
B Change row background color of selected item Using Outlook 1
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0

Similar threads

Back
Top