Accessing a List of Outlook Contacts

by Allen Wyatt
(last updated February 21, 2008)

Doug recently wrote about a problem he was having creating a dialog box that would allow users to select from a list of Outlook contacts. Doug wanted users to pick a contact, and then create a business document using the single contact name.

There are a couple of ways you can approach this problem. The first is to simply add to the toolbar or the Insert menu an Address Book tool that users can utilize to select contacts. You can add this option by following these steps:

  1. Choose Customize from the Tools menu. Word displays the Customize dialog box.
  2. Make sure the Commands tab is selected. (See Figure 1.)
  3. Figure 1. The Commands tab of the Customize dialog box.

  4. In the list of Categories, choose Insert.
  5. In the list of Commands, locate the Address Book command.
  6. Drag the Address Book command either to a place on the toolbar or on the Insert menu.
  7. Click on Close.

Now you should be able to choose the command, which displays the Select Name dialog box and allows you to select a contact. If your contacts are not displayed, then you may not have the Address Book option installed for Word. If this is the case, you may need to run the Office or Word Setup program again and make sure that it is installed.

Because of the convoluted way in which address books are handled in Office, you may want to do a bit more research on this topic. (For instance, address books could come from Outlook contacts, from Outlook Express address book, from an Exchange server, etc. The source used for the address book can affect exactly how you display and select contacts in Word.) For more information, do a search in the Microsoft Knowledge Base for "Contact List" or "Address Book."

If you are automating the creation of your documents, and you want your macros to display a list of contacts from which the user can choose, then you are getting into some fairly advanced areas. Assuming that the user running the macros has Outlook installed on their system, you can access the Outlook object model from within a Word macro and pull a list of the contacts from their Contact list. The following Word macro shows how this can be done:

Sub ListContacts()
    Dim oOL As Object
    Dim oNS As Object
    Dim oContacts As Object
    Dim oContactItem As Object

    Set oOL = CreateObject("Outlook.Application")
    Set oNS = oOL.GetNameSpace("MAPI")
    Set oContacts = oNS.Folders(1).Folders("Contacts")

    For Each oContactItem In oContacts.Items
        Selection.TypeText oContactItem & vbCrLf

    Set oContactItem = Nothing
    Set oContacts = Nothing
    Set oNS = Nothing
    Set oOL = Nothing
End Sub

This macro adds the contact names to the current document, but it could just as easily compile those contact names and add them to a drop-down list in a custom dialog box. The user could then select a name, and that name could be used to extract additional information from the Outlook contact item (oContactItem in this macro). What sort of additional information can be extracted? As anyone who has used Outlook knows, you can store tons of information on any given contact. In fact, the VBA help file for Outlook lists over 140 different properties applicable to contact items.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1554) applies to Microsoft Word , , , , and .

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Printing Just the Visible Data

In a large worksheet, you may want to display and print just a portion of the available data. Displaying the desired ...

Discover More

Speeding Up Document Display

Are your documents displaying too slowly? You can configure Word so that it is as quick as possible on displaying by using ...

Discover More

Black and White Blues

Getting a chart looking its best on a black-and-white printer can be a challenge. This tip examines different ways you can ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!


Getting Rid of Addresses

Word interfaces easily with other Office programs, such as Outlook. As an example, the Envelopes and Labels dialog box ...

Discover More

Using Proper Addresses from Outlook

How to use the Outlook addresses you want in Word.

Discover More

Picking Which Outlook Address to Use in Word

If you Outlook addresses have more than one address each, you may want to select which one is used in Word.

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)