Add Method (Bookmarks Collection)

Applies To

Bookmarks collection object.

Description

Adds a bookmark to a range.

Syntax

expression.Add(Name, Range)

expression Required. An expression that returns a Bookmarks object.

Name Required String. The name of the bookmark. The name cannot be more than one word.

Range Optional Variant. The range of text marked by the bookmark. A bookmark can be set to a collapsed range (the insertion point).

See Also

Exists method, ShowBookmarks property.

Example

This example adds a bookmark named "myplace" to the selection in the active document.

ActiveDocument.Bookmarks.Add Name:= "myplace", Range:= Selection.Range
This example adds a bookmark named "mark" at the insertion point.

ActiveDocument.Bookmarks.Add Name:= "mark"
This example adds a bookmark named "third_para" to the third paragraph in "Letter.doc," and then it displays all the bookmarks for the document in the active window.

Set myDoc = Documents("Letter.doc")
myDoc.Bookmarks.Add Name:="third_para", _
    Range:=myDoc.Paragraphs(3).Range
myDoc.ActiveWindow.View.ShowBookmarks = True