Object:  Application.ActiveDocument.Links.Item(index).outerHTML

This function will return the value of the outerHTML for the index value of the link received.  The outerHTML includes the <a> start tag, the </a> end tag and all the HTML between these two tags.

The OuterHTML for Links.item(2) for this page is:

"<a href="../MicrosoftExpressionWeb.htm">Expression Web VBA Topic Index</a>"

Function GetLinkOuterHTML(ByVal i As Integer) As String
   'Tested 20090208
   On Error GoTo errHandler1
   GetLinkOuterHTML = _
   Application.ActiveDocument.Links. _
   Item(i).outerHTML
   Exit Function
errHandler1:
   'Notify user of failure.
   MsgBox "GetLinkOuterHTML has failed", _
   vbCritical, "Function Failure"
End Function

 

Valid XHTML 1.0 Transitional        Valid CSS!