Bookmarks Property
Applies To
Document object, Range object, Selection object.
Description
Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
See Also
Add method (Bookmarks collection), Name property, ShowHidden property.
Example
This example retrieves the starting and ending character positions for first bookmark in the active document.
With ActiveDocument.Bookmarks(1)
BookStart = .Start
BookEnd = .End
End With
This example uses the aMarks() array to store the name of each bookmark contained in the active document.
If ActiveDocument.Bookmarks.Count >= 1 Then
ReDim aMarks(ActiveDocument.Bookmarks.Count - 1)
i = 0
For Each aBookmark In ActiveDocument.Bookmarks
aMarks(i) = aBookmark.Name
i = i + 1
Next aBookmark
End If
This example applies bold formatting to the first range of bookmarked text in the selection.
If Selection.Bookmarks.Count >= 1 Then
Selection.Bookmarks(1).Range.Bold = True
End If