Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Email in Outlook to Use in Excel

Status
Not open for further replies.

wandan

Technical User
Dec 16, 2001
101
0
0
US
Hello,

I would like to be be able to use a name entered by a user into an Excel form to look up the person's email, phone, etc. from Outlook address book and return those values to Excel. Is this possible? If so, how?

Thanks.
 
You could use something like this:
Code:
Sub GetAContact()
    Dim olApplication As New Outlook.Application
    Dim olNameSpace As Namespace
    Dim MAPIFlder As MAPIFolder
    Dim olContact As ContactItem

    Set olNameSpace = olApplication.GetNamespace("MAPI")
    Set MAPIFlder = olNameSpace.Folders("Personal Folders").Folders("Contacts")

    For Each olContact In MAPIFlder.Items
        If olContact.LastName = "Dummy" Then
            Debug.Print olContact.FullName, olContact.Email1Address, olContact.BusinessTelephoneNumber
        End If
    Next

    Set olContact = Nothing: Set MAPIFlder = Nothing: Set olNameSpace = Nothing: Set olApplication = Nothing
End Sub

using your text boxes or whatever to populate your if statement.

Hope this helps?
 
Thanks! I will give it a try!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top