AnchorElement Object

SharePoint Designer Developer Reference

Represents a specified bookmark in a page.

Interfaces
This object implements the following interfaces

Remarks

Bookmarks are represented by A elements that use the name attribute.

Note

A elements that use the href attribute are links. For information about accessing links, see the LinkElement object.

Use the anchors property to return an ElementCollection object that represents all the anchors in a document. Use the item method to return an AnchorElement object. The following example returns a String array containing the names of all the bookmarks in the specified document.

Visual Basic for Applications
Function GetBookmarks(objDoc As DesignerDocument) As String()
    Dim strTemp() As String
    Dim intCount As Integer
    
    If objDoc.anchors.Length > 0 Then
        ReDim strTemp(objDoc.anchors.Length - 1)
        
        For intCount = 0 To objDoc.anchors.Length - 1
            strTemp(intCount) = objDoc.anchors.Item(intCount).Name
        Next
        
        GetBookmarks = strTemp
    End If
    
End Function

See Also