Document.Bookmarks Property (2007 System)

Gets a Bookmarks collection that represents all the bookmarks in the document.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Bookmarks As Bookmarks
'Usage
Dim instance As Document 
Dim value As Bookmarks 

value = instance.Bookmarks
[BrowsableAttribute(false)]
public Bookmarks Bookmarks { get; }
[BrowsableAttribute(false)]
public:
property Bookmarks^ Bookmarks {
    Bookmarks^ get ();
}
public function get Bookmarks () : Bookmarks

Property Value

Type: Bookmarks
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.

This example is for a document-level customization.

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
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());
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace