Returns an instance of the Hyperlink object by the index of the hyperlink in the hyperlink collection of the document.
Applies to: Document object
[[Set] hyperlinkRet =] object.Hyperlink ( index ) |
The Hyperlink method syntax has these parts:
Part | Description |
object | Required. An expression, that returns an instance of the Document object. |
index | Required. An expression that returns a Long value. Represents the index of the hyperlink in the hyperlink collection of the document. |
hyperlinkRet | Optional. A Hyperlink type variable. |
If index is less than 1 or greater than the number of hyperlinks in the hyperlink collection of the document, the Hyperlink method returns Nothing. Use the HyperlinksNum method to find out the number of hyperlinks in the hyperlink collection of the document.
This example contains a document-level script. It displays the list of properties of each hyperlink in the current document.
' Declare variables Dim hlink As Hyperlink ' Loop through all hyperlinks For i=1 To thisDoc.HyperlinksNum() ' Get next hyperlink from ' the hyperlink collection of the document Set hlink = thisDoc.Hyperlink(i) ' Display the hyperlink properties TRACE "Hyperlink_" & i & " " & hlink TRACE " ID = " & hlink.ID TRACE " LinkType = " & hlink.LinkType TRACE " Address = " & hlink.Address TRACE " LocalPath = " & hlink.LocalPath TRACE " PageID = " & hlink.PageID TRACE " ShapeID = " & hlink.ShapeID Next i |