Address Property

Microsoft Word Visual Basic

ShowAddress property as it applies to the Envelope object.

Returns the envelope delivery address as a Range object. Read-only.

expression.Address

expression    Required. An expression that returns one of the above objects.

Note  An error occurs if you use this property when there hasn't been an envelope added to the specified document.

ShowAddress property as it applies to the Hyperlink object.

Returns or sets the address (for example, a file name or URL) of the specified hyperlink. Read/write String.

expression.Address

expression    Required. An expression that returns one of the above objects.

Example

ShowAs it applies to the Envelope object.

This example displays the delivery address if an envelope has been added to the document; otherwise, it displays a message.

On Error GoTo errhandler
addr = ActiveDocument.Envelope.Address.Text
MsgBox Prompt:=addr, Title:="Delivery Address"
errhandler:
If Err = 5852 Then MsgBox "Insert an envelope into the document"
				

ShowAs it applies to the Hyperlink object.

This example adds a hyperlink to the selection in the active document, sets the address, and then displays the address in a message box.

Set aHLink = ActiveDocument.Hyperlinks.Add( _
    Anchor:=Selection.Range, _
    Address:="http://forms")
MsgBox "The hyperlink goes to " & aHLink.Address
				

If the active document includes hyperlinks, this example inserts a list of the hyperlink destinations at the end of the document.

Set myRange = ActiveDocument _
    .Range(Start:=ActiveDocument.Content.End - 1)
Count = 0
For Each aHyperlink In ActiveDocument.Hyperlinks
    Count = Count + 1
    With myRange
        .InsertAfter "Hyperlink #" & Count & vbTab
        .InsertAfter aHyperlink.Address
        .InsertParagraphAfter
    End With
Next aHyperlink