How to: Update Bookmark Text
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
You can insert text into a placeholder bookmark in a Microsoft Office Word document so that you can retrieve the text at a later time, or to replace text in a bookmark. If you are developing a document-level customization, you can also update text in a Microsoft.Office.Tools.Word.Bookmark control that is bound to data. For more information, see Binding Data to Controls in Office Solutions.
The bookmark object can be one of two types:
A Microsoft.Office.Tools.Word.Bookmark host control.
Microsoft.Office.Tools.Word.Bookmark controls extend native Bookmark objects by enabling data binding and exposing events. For more information about host controls, see Host Items and Host Controls Overview.
A native Bookmark object.
Bookmark objects do not have events or data binding capabilities.
To update bookmark contents using a Bookmark control
Create a procedure that takes a bookmark argument for the name of the bookmark, and a newText argument for the string to assign to the Text property.
To update bookmark contents using a Word Bookmark object
Assigning text to a native Word Bookmark object causes the bookmark to be deleted.
The following code example can be used in a document-level customization.
The following code example can be used in an application-level add-in. This example uses the active document.