Outlook contact lists and fields

grahamvb

Registered User.
Local time
Today, 14:44
Joined
Aug 27, 2013
Messages
57
Hello Access-Programmers,

I would like to read the full name and various address fields from Outlook's contacts. I modified The code below from that found at http://www.vbaexpress.com/forum/showthread.php?27628-accessing-outlook-global-address-book. This accesses Outlooks address book, but it is the list you would get in a new email if you clicked on the TO... button next to the email address field. That list has some version of the contact name, some email addresses and some fax numbers.
Code:
Public Sub GetContacts(varFormName As String, varControlName As String)
 
    Dim Addbox As Object
    Dim outApp As Object, outNS As Outlook.NameSpace
    Dim myAddressList As Outlook.AddressList
    Dim outItem As Object
 
    Set Addbox = Forms(varFormName).Form(varControlName)
    Set outApp = CreateObject("Outlook.Application")
    Set outNS = outApp.GetNamespace("MAPI")
    Set myAddressList = outNS.Session.AddressLists("Contacts")
 
    For Each outItem In myAddressList.AddressEntries
        Addbox.AddItem outItem
    Next
 
    Set outApp = Nothing
 
End Sub
I am trying to get at the full name of the contact and the mailing addresses. Any ideas?

Thank you for looking at this.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom