Export (0) Print
Expand All

Document.SelectionChange Event

Occurs when the selection changes in the document window.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public event SelectionEventHandler SelectionChange

The following code example displays a message that indicates that the selection has changed whenever you change the selection within the document.

private void DocumentSelectionChange()
{
    this.SelectionChange += new Microsoft.Office.Tools.Word.SelectionEventHandler(ThisDocument_SelectionChange);
}

void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
    MessageBox.Show("The selection in the document has changed.");
}

Show:
© 2014 Microsoft