Bookmark.Document Property

Gets the Document associated with the Bookmark control.

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

Syntax

'Declaration
ReadOnly Property Document As Document
Document Document { get; }

Property Value

Type: Document
The Document associated with the Bookmark control.

Examples

The following code example adds a Bookmark control to the first paragraph in the document and then displays the name of the document containing the bookmark.

This example is for a document-level customization.

Private Sub BookmarkDocument()

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    MessageBox.Show("Bookmark1 is located in: " & _
        Bookmark1.Document.FullName)

End Sub
private void BookmarkDocument()
{
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");

    MessageBox.Show("bookmark1 is located in: " + 
        bookmark1.Document.FullName);
}

.NET Framework Security

See Also

Reference

Bookmark Interface

Microsoft.Office.Tools.Word Namespace