Class Bookmark (Word VBA)

The class Bookmark represents a single bookmark in a document, selection, or range. The Bookmark object is a member of the Bookmarks collection. The Bookmarks collection includes all the bookmarks listed in the Bookmark dialog box (Insert menu).

The main procedures of class Bookmark are Copy, Delete, Select and Bookmarks.Add


To use a Bookmark class variable it first needs to be instantiated, for example

Dim bkm as Bookmark
Set bkm = ActiveDocument.Bookmarks(Index:=1)

The following procedures can be used to set variables of type Bookmark: Copy, Bookmarks.Add, Bookmarks.Item, Document.Bookmarks, Range.Bookmarks and Selection.Bookmarks

For Each

Here is an example of processing the Bookmark items in a collection.

Dim bkm As Bookmark
For Each bkm In ActiveDocument.Bookmarks
Next bkm


These are the main methods of the Bookmark class

Copy - Copies a bookmark to the new bookmark specified in the Name argument, and returns a Bookmark object.

Dim strName As String: strName =  
Dim bkmCopy As Bookmark
Set bkmCopy = ActiveDocument.Bookmarks(1).Copy(Name:=strName)

Delete - Deletes the specified bookmark.


Select - Selects the specified bookmark.


Bookmarks.Add - Returns a Bookmark object that represents a bookmark added to a range.

Dim strName As String: strName =  
Dim bkm As Bookmark
Set bkm = ActiveDocument.Bookmarks.Add(Name:=strName)


Column true if the specified bookmark is a table column.

Dim booColumn As Boolean
booColumn = ActiveDocument.Bookmarks(1).Column

Empty true if the specified bookmark is empty.

Dim booEmpty As Boolean
booEmpty = ActiveDocument.Bookmarks(1).Empty

End returns or sets the ending character position of a selection, range, or bookmark.

ActiveDocument.Bookmarks(1).End =

Name returns the name of the specified object.

Dim strName As String
strName = ActiveDocument.Bookmarks(1).Name

Parent returns an object that represents the parent object of the specified Bookmark object.

Dim objParent As Object
Set objParent = ActiveDocument.Bookmarks(1).Parent

Range returns a Range object that represents the portion of a document that's contained in the specified object.

Dim rngRange As Range
Set rngRange = ActiveDocument.Bookmarks(1).Range

Start returns or sets the starting character position of a bookmark.

ActiveDocument.Bookmarks(1).Start =

StoryType returns the story type for the specified range, selection, or bookmark.

Dim wstStoryType As WdStoryType
wstStoryType = ActiveDocument.Bookmarks(1).StoryType

Bookmarks.Count returns the number of items in the Bookmarks collection.

Dim lngCount As Long
lngCount = ActiveDocument.Bookmarks.Count

Bookmarks.DefaultSorting returns or sets the sorting option for bookmark names displayed in the Bookmark dialog box (Insert menu).

ActiveDocument.Bookmarks.DefaultSorting = wdSortByLocation

Bookmarks.Parent returns an object that represents the parent object of the specified Bookmarks collection.

Dim objParent As Object
Set objParent = ActiveDocument.Bookmarks.Parent

Bookmarks.ShowHidden true if hidden bookmarks are included in the Bookmarks collection.

ActiveDocument.Bookmarks.ShowHidden = True