Partager via


Bookmark.Sentences Property

Definition

Gets a Sentences collection that represents all the sentences in the Bookmark control.

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

Property Value

A Sentences collection that represents all the sentences in the Bookmark control.

Examples

The following code example adds a Bookmark control with text to the document and then selects the first sentence in the bookmark.

This example is for a document-level customization.

private void BookmarkSentences()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is the first sentence of bookmark text." +
        " And this is the second sentence.";
    bookmark1.Sentences.First.Select();
}
Private Sub BookmarkSentences()

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

    Bookmark1.Text = "This is the first sentence of bookmark text." _
        & " And this is the second sentence."
    Bookmark1.Sentences.First.Select()

End Sub

Applies to