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)

Syntax

'Declaration
Public Event Deactivate As DocEvents_DeactivateEventHandler
public event DocEvents_DeactivateEventHandler Deactivate

Examples

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.

Sub Worksheet1_Deactivate() Handles Me.Deactivate
    MsgBox(Me.Name & " was deactivated")
End Sub
private void WorksheetDeactivate()
{
    this.Deactivate += new 
        Excel.DocEvents_DeactivateEventHandler(
        Worksheet1_Deactivate);
}

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

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace