SubAddress Property Example

This example displays the subaddress of the selected hyperlink.

If Selection.Range.Hyperlinks.Count >= 1 Then
    MsgBox Selection.Range.Hyperlinks(1).SubAddress
End If

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

Set SCut = ActiveDocument.Hyperlinks.Add( _
    Anchor:= Selection.Range, _
    Address:="C:\My Documents\Other.doc", SubAddress:= "temp")
MsgBox "The hyperlink goes to " & SCut.SubAddress