How to insert information from the Address Book into Microsoft Word

Document status: archived

Applies to Word 97 and above.

When you insert information from the Address Book into a Word document, the items of information and their page layout are pre-defined. Sometimes, this is not suitable. For example, possibly, you want to include information such as a telephone number, or possibly, you want the surname and then the first name.

One method of specifying the information that is extracted and its layout is to use a special AutoText entry called AddressLayout. The Microsoft Knowledge Base article number Q212345 explains how to do this for Word 2000, but the method also applies to Word 97.

A disadvantage with the Microsoft method is that you can have only one format. Using the TechScribe macro, you can specify as many formats as you need by using a different macro for each format.

The macro extracts mailing information from Contacts in Microsoft Outlook. By default, when you select a name, the macro inserts the following data:

Name (as displayed in the Address Book)
Job title
Company
Street (includes the number, and possibly is more than one line)
City
Post code

If the data is missing, a blank line is inserted.

If you are competent with using the VBA macro editor in Word, you can customize the macro to insert anything that is in the Address Book. For details, see the comments in the macro code.

Installation

Address.doc contains a macro project called InsertAddress. This project contains two macros.

  1. InsertCustomAddress. This macro inserts the information into the Word file.
  2. AddCommandToInsertMenu. This macro adds the Custom Address command to the end of the Insert menu in Word. It also adds a keyboard shortcut(underlined letter 'e').

To install the macros:

  1. Copy the macro project item called InsertAddress from Address.doc to your Normal (or other) template using the Organizer dialog box (Tools>Templates and Add-ins>Organizer).
  2. Run the AddCommandToInsertMenu macro using the Macros dialog box (Alt-F8).

Note: If you remove the macros from the template, the Custom Address command stays on the Insert menu in Word. To remove the command, choose Tools>Customize. The Customize dialog box appears. Whilst this is open, choose the Insert menu, and then drag the Custom Address entry off the list.

Using the macro

Note: if Microsoft Outlook is not open, then possibly, the Choose Profile dialog box appears the first time that you use the macro in a Word session.

To insert an address into a Word document:

  1. Choose Insert>Custom Address. The Address Book appears. (If no document is open, the macro does not run.)
  2. Select a name. The address details are inserted.

Downloads

 address.doc, 29 KB.

 address.bas, 4 KB. (This is the macro code as a text file that can be imported into the VBA editor.)

RSS feed