Outlook macro to automate search and forward process

mkunk1

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
is this possible?
Is there a way to use a macro that will search an inbox for a part of a subject line from an email then forward the search results to another email?
Example: Macro is triggered, for each COMPLETE email in the inbox, subject line of the email is “This is the subject COMPLETE”, I want outlook to search my inbox for ”subject”, any emails with “subject” in the subject line get forwarded to a different email then move on to the next email with COMPLETE in it and repeat.

To clarify, the macro should always search the item (combination of letters and numbers, always 15 characters long) to the left of COMPLETE.
Also, it would not need to be triggered once the COMPLETE email comes into the inbox (ok to be triggered manually) but would need to treat each complete email as a separate “job” to repeat the search and forward for each email with complete in the subject.
Thanks!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yeah, it would be possible. If there are not many messages in the folder, you can just loop through the folder, but if there are a lot, you'll want to use a filter 9Find or Restrict function) then loop the results to send.

I'll see if i can find some code that comes close to what you want.
 

mkunk1

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yeah, it would be possible. If there are not many messages in the folder, you can just loop through the folder, but if there are a lot, you'll want to use a filter 9Find or Restrict function) then loop the results to send.

I'll see if i can find some code that comes close to what you want.
Thank you Diane. I have tried googling and searching for a similar code, is there anywhere in particular you would recommend looking?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
i have this macro which is close - then we just need to loop the results and send. I'm pretty sure i have something to loop - sending is easy.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
this example uses a slower method- checking for the value then doing whatever - it would be slow if you had much mail.
 

mkunk1

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
i have this macro which is close - then we just need to loop the results and send. I'm pretty sure i have something to loop - sending is easy.
Would this find the related messages by subject? The only issue is sometimes a new email is sent for the same topic instead of a reply and as such the subject line may not be identical across all the emails.
 

mkunk1

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Would this find the related messages by a keyword(s) in the subject? The only issue is sometimes a new email is sent for the same topic instead of a reply and as such the subject line may not be identical across all the emails.
Edited. "keyword(s) in the subject"
 
Top