Document.Bookmarks property (Word)
Returns a Bookmarks collection that represents all the bookmarks in a document. Read-only.
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 retrieves the starting and ending character positions for the 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.