Freigeben über


WorksheetBase.Deactivate Event

Definition

Occurs when the worksheet loses focus.

public:
 event Microsoft::Office::Interop::Excel::DocEvents_DeactivateEventHandler ^ Deactivate;
public event Microsoft.Office.Interop.Excel.DocEvents_DeactivateEventHandler Deactivate;
member this.Deactivate : Microsoft.Office.Interop.Excel.DocEvents_DeactivateEventHandler 
Public Custom Event Deactivate As DocEvents_DeactivateEventHandler 

Event Type

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.

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

void Worksheet1_Deactivate()
{
    MessageBox.Show(this.Name + " was deactivated");
}
Sub Worksheet1_Deactivate() Handles Me.Deactivate
    MsgBox(Me.Name & " was deactivated")
End Sub

Applies to