How can i sort or seperate resolved names and unresolved names from Outlook TO box.

Hi,

How can i sort or seperate resolved names and unresolved names from Outlook TO box.
I have say 600+ names that i pasted in the TO box of a new mail. There are a lot of names that have not got resolved. How can i just get those names seperated.

Any solution any way is fine for me. Just need to get the unresolved names seperated from the resolved names.

Exchange 2003 /Outlook 2007

Regards
Sharath
LVL 11
bsharathAsked:
Who is Participating?
 
David LeeConnect With a Mentor Commented:
This should do it.  Add the code to Outlook.  Create a message and enter the addressees.  Run the macro with the message still open.  It'll write all the unresolved addresses to a text file.
Sub GetUnresolved()
    Dim objFSO As Object, objFile As Object, olkRecipient As Outlook.Recipient
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Change the file name and path on the next line'
    Set objFile = objFSO.CreateTextFile("C:\eetesting\Unresolved Addresses.txt", True)
    For Each olkRecipient In Outlook.ActiveInspector.CurrentItem.Recipients
        If Not olkRecipient.Resolved Then
            objFile.WriteLine "Name: " & olkRecipient.Name & vbTab & "Address: " & olkRecipient.Address
        End If
    Next
    objFile.Close
    Set objFile = Nothing
    Set objFSO = Nothing
    Set olkRecipient = Nothing
    MsgBox "Done"
End Sub

Open in new window

0
 
David LeeCommented:
Hi, Sharath.

There is no way to separate them in the To field.  What do you want to do with the unresolved names?  Just identify them, remove them from the message, something else?
0
 
bsharathAuthor Commented:
I want to get them to a txt or excel so i can see why they are not resolving
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
bsharathAuthor Commented:
Thanks David this is Awsome help...

Was very useful at this time...

I get this
Name: Sharath rty Address:
Can i just get the name
0
 
David LeeCommented:
Sure.  Change line #8 from

    objFile.WriteLine "Name: " & olkRecipient.Name & vbTab & "Address: " & olkRecipient.Address
 
to either

    objFile.WriteLine "Name: " & olkRecipient.Name

or

   objFile.WriteLine olkRecipient.Name

The former includes the literal "Name" the latter has just the name.
0
 
bsharathAuthor Commented:
Thank U David....
0
 
David LeeCommented:
You're welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.