Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Occurs when any sheet is deactivated.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Event SheetDeactivate As WorkbookEvents_SheetDeactivateEventHandler
'Usage
Dim instance As Workbook
Dim handler As WorkbookEvents_SheetDeactivateEventHandler
AddHandler instance.SheetDeactivate, handler
public event WorkbookEvents_SheetDeactivateEventHandler SheetDeactivate
public:
event WorkbookEvents_SheetDeactivateEventHandler^ SheetDeactivate {
void add (WorkbookEvents_SheetDeactivateEventHandler^ value);
void remove (WorkbookEvents_SheetDeactivateEventHandler^ value);
}
JScript does not support events.
Examples
The following code example demonstrates a handler for the SheetDeactivate event. The event handler displays the name of the worksheet that was deactivated.
This example is for a document-level customization.
Private Sub ThisWorkbook_SheetDeactivate(ByVal Sh As Object) _
Handles Me.SheetDeactivate
Dim sheet As Excel.Worksheet = CType(Sh, Excel.Worksheet)
MsgBox(sheet.Name & " Deactivated")
End Sub
private void WorkbookSheetDeactivate()
{
this.SheetDeactivate +=
new Excel.WorkbookEvents_SheetDeactivateEventHandler(
ThisWorkbook_SheetDeactivate);
}
private void ThisWorkbook_SheetDeactivate(object Sh)
{
Excel.Worksheet sheet = (Excel.Worksheet)Sh;
MessageBox.Show(sheet.Name + " 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.