+ Reply to Thread
Results 1 to 7 of 7

Getting E-Mail from ActiveInspector.CurrentItem.To

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    All over the world
    MS-Off Ver
    Excel 2013
    Posts
    11

    Getting E-Mail from ActiveInspector.CurrentItem.To

    Hi All

    I have this problem I’ve been working on for far too long.

    I need to extract the E-Mail addresses from the “To” line of an E-Mail.
    I’ve been using:
    Please Login or Register  to view this content.
    However, if the E-Mail is in my contact list, the “To” line convert the E-Mail address to the name of the contact – and when I try extract the E-Mail I only get the contact name.
    See picture: 6-27-2013 9-44-17 AM.png

    Additional info:
    • I have been programming VBA for Excel for about a year now.
    • We am using Office 360 as our mail provider
    • There are not always a logic in the E-Mailing naming convention. Therefore I can’t use makeEmailFunction(“Carlsson, Martin”) => [email protected]
    • I am running 2013 – but the macro should work on 2007 and 2010 as well. Therefore, if your solution only covers one of versions, it will be cool as well.
    • I need the E-Mail address to be put in: "ReplyRecipients.Add"

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    You need the recipients property of your mail item, eg:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-20-2012
    Location
    All over the world
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    Thanks - but it doesn't work.

    The content of "Have replies sent to" is now:
    "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=05A01997DDD14E5BB1B867892B7EAD37-MARTIN CARL; [email protected]"
    See picture: Have replies sent to.png

    Quote Originally Posted by yudlugar View Post
    You need the recipients property of your mail item, eg:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    Eurgh, I think this is a version thing, I'm using excel 2003. Googling about a bit I found this:
    i.AddressEntry.GetExchangeUser.PrimarySmtpAddress
    It doesn't work in my version but it might do the job for you.
    Please Login or Register  to view this content.
    Alternatively google: vba CN=RECIPIENTS
    and there are a few methods to try on how to convert it to a [email protected] address

  5. #5
    Registered User
    Join Date
    07-20-2012
    Location
    All over the world
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    Awesome! It works for “Carlsson, Martin” – and it gives the right E-Mail address.
    Thank you so much!

    It gives a run-time error when the loop hits the real E-Mail [email protected]
    See picture: Run-time error 91.png
    I will post the workaround here if anyone in the future should stumble upon this problem and find thin thread via google.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    Ah right yeah, you'll need to separate between picking up addresses and smtpaddresses for non-contacts and contacts respectively. Maybe:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-20-2012
    Location
    All over the world
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Getting E-Mail from ActiveInspector.CurrentItem.To

    Perfect!

    You are so awesome!

    Quote Originally Posted by yudlugar View Post
    Ah right yeah, you'll need to separate between picking up addresses and smtpaddresses for non-contacts and contacts respectively. Maybe:
    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)

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