+ Reply to Thread
Results 1 to 10 of 10

Autoforward incoming emails with specific words in subject.

  1. #1
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Autoforward incoming emails with specific words in subject.

    Hello,

    I would like a VBA script that will forward any incoming emails with specific words in the subject.

    Example, I wan to to forward emails with 3RE, First Name, Last Name, in the subject.

    The problem is that the subject always have the 3RE, first and last names, but in random order. It could be Last, First, 3RE, or frist, last, 3re or have other words between the words.

    So far i have this code that I sort of modified, but I am not able to get it to work.

    Please Login or Register  to view this content.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Autoforward incoming emails with specific words in subject.

    Oulook has built-in rules for all sorts of conditions. You get into the RULES from teh Home tab/Move/Rules.

    Most are easy follow and apply, the Rules window walks you through all the steps
    Oulook Rules.JPG
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Autoforward incoming emails with specific words in subject.

    I understand that there are rules, and believe me I was trying those before moving into scripts.

    The reason rules will not work, is because when I try to select "Emails with specific words in subject", and try to add those three words, it puts an "OR" instead of an "AND". So it will forward emails with either of those three words.

    What I want it to do is that if the subject contains, word1 and word2 and word3, then, forward to [email protected].

    The words are not in order, sometimes there are other words between the words, such as: subject: This email for john has the 3RE and something Gordon
    Last edited by jflores80; 12-11-2015 at 08:31 PM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Autoforward incoming emails with specific words in subject.

    You can have more than 1 rule, could you set up 3 rules for that?

  5. #5
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Autoforward incoming emails with specific words in subject.

    Yes, I have tried three rules, with the subject and put them in categories. The thing is that various emails have the word "3RE" in them. So, it has been forwarding all of the emails with "3RE" in the subject, and seems to skip the other two words. Another reason is that the subjects will contain "3RE" and first name, last name in the subject, and the first and last name are different people.

    Total, there are 4 people's name in the subject that I need forwarded to another person outside the firm, and rules seem to not work.

  6. #6
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: Autoforward incoming emails with specific words in subject.

    "I am not able to get it to work." is not useful. What is the problem.
    To mark "Solved" go to Thread Tools.

  7. #7
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Autoforward incoming emails with specific words in subject.

    The problem is that, We get lots of emails from the same domain name @something.com, and I want to forward only certain emails that contain a first name, last name and the word 3RE in the subject line to another person.

    With rules we can not achieve that, as it will forward everything that came in with either 3RE or just first or last name.

    I want to be able to have a rule, that will check for all the three words in the subject line and forward the email, but only if it has those three words in the subject line.

    Now the words will not be in the same order every time as it gets sent by different users on that email domain name.

  8. #8
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: Autoforward incoming emails with specific words in subject.

    Quote Originally Posted by jflores80 View Post

    Please Login or Register  to view this content.
    I can only guess that you want this working code to be in Run A Script format to be used in a rule. I suggest ItemAdd is more reliable. Processing Incoming E-mails with Macros http://www.slipstick.com/developer/p...s-with-macros/ . Try it if Run A Script fails.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Autoforward incoming emails with specific words in subject.

    Actually this seems to work very well with VBA in outlook. It actually brings up a email with the TO: filled out.

    I have tested with different names and seems to do the trick.

    One last thing though, how do I get this to send automatically, without it popping up an email for me to send it manually? In other words, just have it send automatically without any interaction from myself?

    Please Login or Register  to view this content.
    Last edited by jflores80; 12-15-2015 at 06:11 PM.

  10. #10
    Registered User
    Join Date
    12-11-2015
    Location
    San Diego, CA
    MS-Off Ver
    2013
    Posts
    7

    Re: Autoforward incoming emails with specific words in subject.

    Well I actually figured it out. Here is my final Code.

    Please Login or Register  to view this content.
    Thank you all for the Great response and assistance, this helped me a-lot. I appreciate it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find and record emails' subject
    By afonja in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-27-2014, 03:37 PM
  2. Replies: 0
    Last Post: 04-10-2014, 05:12 AM
  3. Importing emails and subject line
    By sathishkm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-21-2013, 07:02 AM
  4. [Outlook 2010] Macro to import data from incoming emails
    By vidaLL in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2013, 04:42 PM
  5. Opening emails based on subject
    By MikeFranz123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2013, 02:15 AM
  6. Extracting data from all emails with a specific subject
    By kefalo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-29-2010, 06:14 PM
  7. how to stop emails incoming its taking a long time to download
    By emails incoming in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-24-2006, 10:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1