+ Reply to Thread
Results 1 to 3 of 3

Forward Email Based on Selected Object's Subject and/or Sender and Recipient Address

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    14

    Forward Email Based on Selected Object's Subject and/or Sender and Recipient Address

    Kind of a long title, so I'll try to explain here.

    The code is to run based off the currently selected emails in a folder. The code works fine, but I would like to add a few small changes that would greatly improve my productivity. The code looks through my selected item's subject for a key word using InStr and then will forward the email to myDesiredRecipient should the keyword be found. The code also does the same thing for the body of the email. I would like to add a portion to the code that would check three other criteria before forwarding the email to myDesiredRecipient.

    The three criteria I would like it to check are:
    1. SenderEmailAddress -- There is a nice property for this, I think a simple "If SenderEmailAddress = "myDesiredSender" Then" would work.
    2. RecipientEmailAddress -- I could not find a simple way to check the recipients of my current selection.
    3. CCEmailAddress -- Same as Recipients, but for those emails listed as CC'd.

    Below is the original code that is 100% working. Beneath this section of code, I will add the essence of the code that I wish to create (not working).

    Working:
    Please Login or Register  to view this content.

    The below code should look for the keyword in the subject AND check for myDesiredRecipient's email address in the TO, From, and CC. If both are True, the email is marked as actioned. If only the keyword is found, the email will be forwarded to myDesiredRecipient. The same block of code will repeat for the body.

    Not Working
    Please Login or Register  to view this content.
    Thank you for reading. Appreciate any help! Thanks
    Last edited by Citanaf; 04-21-2015 at 08:48 PM. Reason: Thanks

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

    Re: Forward Email Based on Selected Object's Subject and/or Sender and Recipient Address

    This demonstrates how you could determine the text associated with the sender and the recipients.

    Please Login or Register  to view this content.
    You could try to determine SMTP addresses, those with the @ sign, but that is a bit more complicated.
    Last edited by skatonni; 06-01-2015 at 05:33 PM.
    To mark "Solved" go to Thread Tools.

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

    Re: Forward Email Based on Selected Object's Subject and/or Sender and Recipient Address

    How can I modify your Working Quote to where I am looking for three specific words in the subject, and how do I add it to Outlook. I am a n00b at VBA.

    Thanks,

    [QUOTE=Citanaf;4052030]Kind of a long title, so I'll try to explain here.

    The code is to run based off the currently selected emails in a folder. The code works fine, but I would like to add a few small changes that would greatly improve my productivity. The code looks through my selected item's subject for a key word using InStr and then will forward the email to myDesiredRecipient should the keyword be found. The code also does the same thing for the body of the email. I would like to add a portion to the code that would check three other criteria before forwarding the email to myDesiredRecipient.

    The three criteria I would like it to check are:
    1. SenderEmailAddress -- There is a nice property for this, I think a simple "If SenderEmailAddress = "myDesiredSender" Then" would work.
    2. RecipientEmailAddress -- I could not find a simple way to check the recipients of my current selection.
    3. CCEmailAddress -- Same as Recipients, but for those emails listed as CC'd.

    Below is the original code that is 100% working. Beneath this section of code, I will add the essence of the code that I wish to create (not working).

    Working:
    Please Login or Register  to view this content.

+ 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. Getting SMTP Email Address of an Exchange Sender
    By RhettL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2014, 11:12 PM
  2. [SOLVED] Recovering the default sender outlook email address from vba on excel
    By Alain-79 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2013, 03:53 AM
  3. [SOLVED] VBA to open a new email, (outlook) add the recipient, and the subject of 'Issue Found'
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2012, 03:42 AM
  4. Replies: 1
    Last Post: 03-08-2012, 01:57 PM
  5. Replies: 6
    Last Post: 12-02-2011, 02:14 PM

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