Worksheet.Deactivate Event (2007 System)
Occurs when the worksheet loses focus.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Event Deactivate As DocEvents_DeactivateEventHandler
'Usage
Dim instance As Worksheet
Dim handler As DocEvents_DeactivateEventHandler
AddHandler instance.Deactivate, handler
public event DocEvents_DeactivateEventHandler Deactivate
public:
event DocEvents_DeactivateEventHandler^ Deactivate {
void add (DocEvents_DeactivateEventHandler^ value);
void remove (DocEvents_DeactivateEventHandler^ value);
}
JScript does not support events.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.