ControlCollection::AddBookmark Method (Range^, String^)

 

Adds a new Bookmark control to the document at the specified range.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Bookmark^ AddBookmark(
	Range^ range,
	String^ name
)

Parameters

range
Type: Microsoft.Office.Interop.Word::Range^

A Range that provides the bounds for the control.

name
Type: System::String^

The name that can be used to index the control in the ControlCollection instance.

Return Value

Type: Microsoft.Office.Tools.Word::Bookmark^

The Bookmark control that was added to the ControlCollection instance.

Exception Condition
ArgumentNullException

The name or range argument is null, or the name argument has zero length.

ControlNameAlreadyExistsException

A control with the same name is already in the ControlCollection instance.

InvalidRangeException

The range that was specified is not valid.

This method enables you to add Bookmark controls to the end of the ControlCollection.

To remove a Bookmark control that was added programmatically, use the Remove method.

The following code example adds a Bookmark control to the document, and then adds text to the bookmark.

No code example is currently available or this language may not be supported.
Return to top
Show: