View Full Version : How to strip First/Last name from Outlook ?

12-27-2005, 04:22 PM
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 ? :dunno


01-03-2006, 07:55 AM
Well, It's easy enough to get the display name for each email item'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
Nexthowever, 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.
etc... etc...

or is that not an issue?

01-03-2006, 11:08 AM
Not an issue, thanks! for your time and effort.