Address Property

Microsoft Publisher Visual Basic

expression.Address

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example displays the URL addresses for all hyperlinks in the active publication.

Sub ShowHyperlinkAddresses()
    Dim pgsPage As Page
    Dim shpShape As Shape
    Dim hprLink As Hyperlink
    Dim intCount As Integer
    For Each pgsPage In ActiveDocument.Pages
        For Each shpShape In pgsPage.Shapes
            If shpShape.TextFrame.TextRange.Hyperlinks.Count > 0 Then
                For Each hprLink In shpShape.TextFrame.TextRange.Hyperlinks
                    MsgBox "This hyperlink goes to " & hprLink.Address & "."
                    intCount = intCount + 1
                Next hprLink
            ElseIf shpShape.Hyperlink.Address <> "" Then
                MsgBox "This hyperlink goes to " & shpShape.Hyperlink.Address & "."
                intCount = intCount + 1
            End If
        Next shpShape
    Next pgsPage
    If intCount < 1 Then
        MsgBox "You don't have any hyperlinks in your publication."
    Else
        MsgBox "You have " & intCount & " hyperlinks in " & ThisDocument.Name & "."
    End If
End Sub