DocumentBase.Bookmarks Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a Bookmarks collection that represents all the bookmarks in the document.
public Microsoft.Office.Interop.Word.Bookmarks Bookmarks { get; }
Property Value
A Bookmarks collection that represents all the bookmarks in the document.
Examples
The following code example adds a Bookmark control to the first paragraph and then displays a message that shows the total number of bookmarks in the document. To use this example, run it from the ThisDocument class in a document-level project.
private void DocumentBookmarks()
{
this.Paragraphs[1].Range.InsertParagraphAfter();
this.Controls.AddBookmark(this.Paragraphs[1].Range, "bookmark1");
MessageBox.Show("Total number of bookmarks: " + this.Bookmarks.Count.ToString());
}
Private Sub DocumentBookmarks()
Me.Paragraphs(1).Range.InsertParagraphAfter()
Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "bookmark1")
MessageBox.Show("Total number of bookmarks: " & Me.Bookmarks.Count.ToString())
End Sub