Freigeben über


Bookmark.Document Property

Definition

Gets the Document associated with the Bookmark control.

public:
 property Microsoft::Office::Interop::Word::Document ^ Document { Microsoft::Office::Interop::Word::Document ^ get(); };
public Microsoft.Office.Interop.Word.Document Document { get; }
member this.Document : Microsoft.Office.Interop.Word.Document
Public ReadOnly Property Document As Document

Property Value

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

Applies to