Consulting

Results 1 to 3 of 3

Thread: How to strip First/Last name from Outlook ?

  1. #1
    VBAX Regular
    Joined
    Mar 2005
    Posts
    35
    Location

    Unhappy How to strip First/Last name from Outlook ?

    Ok, Microsoft Outlook (not express), when I open it, and click on my Inbox, I see a list of the individual emais in that folder.

    Let's say that day there are over 400 emails, I want to figure out a way to look into the INBOX and look into each email and strip the First and Last name of the sender (don't care about their email address) and then put that into an Excel Sheet, with two columns for first and last name.

    I did almost the opposite before, I had a Macro look into the column M I think it was of an excel sheet, strip the emails and format an email and then send it via outlook, that works, what about the other way around ?

    Please let me know.

    How can one do this ?


  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Well, It's easy enough to get the display name for each email item[VBA]'print all the inbox mail item's display
    'names to the immediate window
    Dim TargetFolder As MAPIFolder
    Dim objMail As MailItem

    Dim ns As NameSpace
    Set ns = Application.GetNamespace("MAPI")
    Set TargetFolder = ns.GetDefaultFolder(olFolderInbox)
    For Each objMail In TargetFolder.Items
    Debug.Print objMail.SenderName
    Next[/VBA]however, unless every mail you get is in your contact list, you're going to have various formats:
    John Smith
    John R. Smith
    John R. Smith (domainname)
    Smith, John R.
    john.smith@somewhere.net
    etc... etc...

    or is that not an issue?
    K :-)

  3. #3
    VBAX Regular
    Joined
    Mar 2005
    Posts
    35
    Location
    Not an issue, thanks! for your time and effort.

Posting Permissions

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