ControlCollection::AddBookmark Method (Range^, String^)
Adds a new Bookmark control to the document at the specified range.
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
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.
Show: