GetAddress$()

Syntax

GetAddress$([Name$], [AddressProperties$], [UseAutoText], [DisplaySelectDialog], [SelectDialog], [CheckNamesDialog], [MRUChoice], [UpdateMRU])

Remarks

Returns an address from the default address book. GetAddress$() is available only if you have Windows 95 and either Microsoft Exchange or Schedule+ version 2.0 installed. In Word version 6.0, GetAddress$() is unavailable and generates an error.

Argument

Explanation

Name$

The name of the addressee, as specified in the Search Name dialog box in the address book.

AddressProperties$

If UseAutoText is set to 1, AddressProperties$ specifies the name of an AutoText entry that defines a sequence of address book properties.

If UseAutoText is set to 0 (zero) or omitted, AddressProperties$ defines a custom layout. Valid address book property name or sets of property names are surrounded by angle brackets ("<" and ">") and separated by a space or a paragraph mark (for example, "<PR_GIVEN_NAME> <PR_SURNAME>" + Chr$(13) + "<PR_OFFICE_TELEPHONE_NUMBER>".)

If AddressProperties$ is omitted, Word looks for the default AutoText entry, "AddressLayout". If "AddressLayout" hasn't been defined, Word uses the following layout definition for the address: "<PR_GIVEN_NAME> <PR_SURNAME>" + Chr$(13) + "<PR_STREET_ADDRESS>" + Chr$(13) + "<PR_LOCALITY>" + ", " + "<PR_STATE_OR_PROVINCE>" + " " + "<PR_POSTAL_CODE>" + Chr$(13) + "<PR_COUNTRY>".

For a list of the valid address book property names, see AddAddress.


Argument

Explanation

UseAutoText

Indicates the value that AddressProperties$ specifies:

0 (zero) or omitted Defines the layout of the address book properties.

1 Specifies the name of the AutoText entry that defines the layout of the address book properties.

DisplaySelectDialog

Specifies whether the Select Name dialog box is displayed:

0 (zero) The Select Name dialog box is not displayed.

1 or omitted The Select Name dialog box is displayed.

2 The Select Name dialog box is not displayed, but no search for a specific name is performed. The address returned by GetAddress$() will be the previously selected address.

SelectDialog

Specifies how the Select Name dialog box should be displayed:

0 (zero) or omitted In Browse mode

1 In Compose mode, with only the To: box

2 In Compose mode, with both the To: and CC: boxes

CheckNamesDialog

Specifies whether to display the Check Names dialog box when the value of Name$ is not specific enough:

0 (zero) The Check Names dialog box is not displayed.

1 or omitted The Check Names dialog box is displayed.

This parameter is ignored if DisplaySelectDialog is nonzero.

If SelectDialog is set to 1 or 2, all names are resolved before the Select Names dialog box is closed.

MRUChoice

Specifies which list of most recently used addresses to use as the address list:

0 (zero) or omitted The list of delivery addresses

1 The list of return addresses

UpdateMRU

Specifies whether the new address is added to the list of most recently used addresses:

0 (zero) or omitted The address is not added.

1 The address is added.

If SelectDialog is set to 1 or 2, UpdateMRU is ignored.


Examples

This example sets the variable letterAddress$ to John Smith's address, moves the insertion point to the beginning of the document, and inserts the address. The inserted address will include the default address book properties.


letterAddress$ = GetAddress$("John Smith", "", 0, 0)
StartOfDocument
Insert letterAddress$

The following example inserts John Smith's address, using the "My Address Layout" AutoText entry as the layout definition. "My Address Layout" is defined in the active template and contains a set of address properties assigned to the text$ variable. The example also adds John Smith's address to the list of most recently used addresses.


text$ = "<PR_GIVEN_NAME> <PR_SURNAME>" + Chr$(13) + \
    "<PR_STREET_ADDRESS>" + Chr$(13) + "<PR_LOCALITY>" + \
    ", " + "<PR_STATE_OR_PROVINCE>" + "  " + "<PR_POSTAL_CODE>" + \
    Chr$(13) + "<PR_OFFICE_TELEPHONE_NUMBER>"
SetAutoText "My Address Layout", text$, 1
letterAddress$ = GetAddress$("John Smith", "My Address Layout", 
\ 1, , , , , 1) StartOfDocument Insert letterAddress$

The following example inserts information from the same address at two different locations in the active document, using a different set of properties for each location. In this example, the second GetAddress$() instruction does not display the Select Name dialog box of the address book.


letterAddress$ = GetAddress$("John Smith", \
    "<PR_GIVEN_NAME> <PR_SURNAME>" + Chr$(13) + \
    "<PR_STREET_ADDRESS>" + Chr$(13) + "<PR_LOCALITY>" + \
    ", " + "<PR_STATE_OR_PROVINCE>" + "  " + "<PR_POSTAL_CODE>" + \
    Chr$(13) + "<PR_OFFICE_TELEPHONE_NUMBER>", 0, 0)
letterGivenName$ = GetAddress$( , "<PR_GIVEN_NAME>", , 2)
StartOfDocument
Insert letterAddress$
InsertPara
Insert "Dear "
Insert letterGivenName$
InsertPara

See Also

AddAddress, AutoText, InsertAddress, ToolsCreateEnvelope, ToolsCreateLabels