This example sets the variable letAddress
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.
letAddress = Application.GetAddress(Name:="John Smith", _
CheckNamesDialog:=True)
ActiveDocument.Range(Start:=0, End:=0).InsertAfter letAddress
The following example returns 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 recently used addresses.
Dim TagIDArray(0 To 3) As String
Dim ValueArray(0 To 3) As String
TagIDArray(0) = "PR_DISPLAY_NAME"
TagIDArray(1) = "PR_GIVEN_NAME"
TagIDArray(2) = "PR_SURNAME"
TagIDArray(3) = "PR_COMMENT"
ValueArray(0) = "Display_Name"
ValueArray(1) = "John"
ValueArray(2) = "Smith"
ValueArray(3) = "This is a comment"
Application.AddAddress TagID:=TagIDArray(), Value:=ValueArray()
addr = Application.GetAddress(Name:="John Smith", _
UpdateRecentAddresses:=True)