WorksheetBase.Deactivate Event

Occurs when the worksheet loses focus.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public event DocEvents_DeactivateEventHandler Deactivate

The following code example demonstrates a handler for the Deactivate event that displays the name of the worksheet when it is deactivated.

This example is for a document-level customization.

private void WorksheetDeactivate()
{
    this.Deactivate += new 
        Excel.DocEvents_DeactivateEventHandler(
        Worksheet1_Deactivate);
}

void Worksheet1_Deactivate()
{
    MessageBox.Show(this.Name + " was deactivated");
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft