Returns an IHTMLElementCollection collection that represents the collection of all links in the current document.
expression.links
expression Required. An expression that returns a DispFPHTMLDocument object.
This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position.
The following example returns the collection of all links in the document and displays the number of links in the collection.
Sub ReturnLinks()
'Returns the collection of all links in the document
Dim objApp As FrontPage.Application
Dim objLinks As IHTMLElementCollection
Set objApp = FrontPage.Application
Set objLinks = objApp.ActiveDocument.links
'If not 0 links exist in the document
If Not objLinks.Length = 0 Then
'If only one link exists
If objLinks.Length = 1 Then
MsgBox "There is only one link in the collection."
'If more than one link exists
ElseIf objLinks.Length > 1 Then
MsgBox "There are " & objLinks.Length & _
" hyperlinks in the current document."
End If
Else
'Otherwise display message to user.
MsgBox "There are no links in the collection."
End If
End Sub