+ Reply to Thread
Results 1 to 4 of 4

IF statement based on email subject string

  1. #1
    Forum Contributor
    Join Date
    06-30-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2013
    Posts
    246

    IF statement based on email subject string

    Hi,

    I'm still somewhat new to VBA and even newer to integrating it with outlook. Appreciate any help.

    I have an email message archived on my network, let's call it TestEmail. The subject of said email may or may not include the string "UPDATED" to represent a change in a portfolio. There are also two variables included in my code, which will change depending on whether or not the subject includes the aforementioned string.

    The email subject will either be:
    "5/19/2020 Trading - NO CHANGE, Exposure: 44%"

    or:
    "5/18/2020 Trading - UPDATED EXPOSURE TO: 44% FROM: 39%"

    I originally tried an IF statement along with MID function (shown below) because i was under the impression the structure/formatting of the subject wouldn't be changing, but now it seems like that's not true. What will NOT change is the first part (MM/DD/YYYY - Trading")
    All of that said, based on the above email subjects, what's the best way to grab the appropriate numbers?

    The goal is the below:
    For the 5/19 email:
    PriorDaySignalEmail = 44 =CurrentDaySignalEmail

    For the 5/18 email:
    PriorDaySignalEmail = 39
    CurrentDaySignalEmail = 44

    Please Login or Register  to view this content.
    Thanks again!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,083

    Re: IF statement based on email subject string

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    06-30-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2013
    Posts
    246

    Re: IF statement based on email subject string

    Thanks so much, I think this is a step in the right direction. The different signals are coming up as 0 or blank and i'm wondering if it's because of how I'm declaring the variables. Since "split" returns an array, do i declare like this

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-30-2017
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2013
    Posts
    246

    Re: IF statement based on email subject string

    Forget my reply, this works great. Thanks so much, 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. Opening .Xls Attachement from Email based on Subject/Sender
    By lougs7 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-09-2020, 05:26 AM
  2. [SOLVED] Change Email subject based on date and time
    By ceminess in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-04-2018, 04:43 AM
  3. Read and compare subject string from new received email in Outlook
    By alexgoaga in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 08-23-2017, 04:44 AM
  4. Forward Email Based on Selected Object's Subject and/or Sender and Recipient Address
    By Citanaf in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 12-11-2015, 07:38 PM
  5. Mass Emailing based of column values: Email, Subject, File
    By GingerMountain in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-29-2015, 01:06 PM
  6. Macro Automate Email Subject Line Based on Cell Value
    By richzipday in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2013, 06:33 PM
  7. Want to populate email fields FROM, TO, CC, Subject based on a named range
    By mbhc77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2012, 12:24 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