Document.Hyperlinks Property (Word)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a Hyperlinks collection that represents all the hyperlinks in the specified document. Read-only.

expression .Hyperlinks

expression A variable that represents a Document object.

For information about returning a single member of a collection, see Returning an Object from a Collection.

This example displays the target address of the second hyperlink in Home.doc.

If Documents("Home.doc").Hyperlinks.Count >= 2 Then 
 MsgBox Documents("Home.doc").Hyperlinks(2).Name 
End If

This example displays the name of every hyperlink in the active document that includes the word "Microsoft" in its address.

For Each aHyperlink In ActiveDocument.Hyperlinks 
 If InStr(LCase(aHyperlink.Address), "microsoft") <> 0 Then 
 MsgBox aHyperlink.Name 
 End If 
Next aHyperlink