SelectionEventArgs Interface

Provides data for the SelectionChange, Selected, and Deselected events of a Bookmark control.

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

public interface SelectionEventArgs

The SelectionEventArgs type exposes the following members.

Public propertySelectionGets a Selection that represents the text that was selected.

The following code example adds a Bookmark control with text to the document and then creates a Selected event handler. A message box is displayed when you move the cursor into the bookmark.

This example is for a document-level customization.

Microsoft.Office.Tools.Word.Bookmark bookmark4;

private void BookmarkSelected()
    bookmark4 = this.Controls.AddBookmark(this.Paragraphs[1]
        .Range, "bookmark4");
    bookmark4.Text = "This is a sample bookmark.";
    bookmark4.Selected += new Microsoft.Office.Tools

void bookmark4_Selected(object sender, Microsoft.Office.Tools
    .Word.SelectionEventArgs e)
    MessageBox.Show("The selection has moved to bookmark1.");

Community Additions