Bookmark.Name Property
Visual Studio 2005
Gets the name of the Bookmark control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)
The following code example adds a Bookmark control with text to the first paragraph and then displays the bookmark's name in a message box.
private void BookmarkName() { this.Paragraphs[1].Range.InsertParagraphBefore(); Microsoft.Office.Tools.Word.Bookmark bookmark1 = this.Controls.AddBookmark(this.Paragraphs[1].Range, "bookmark1"); bookmark1.Text = "This is sample bookmark text."; MessageBox.Show("The bookmark's name is " + bookmark1.Name); }