Workbook.Deactivate Event (2007 System)
Occurs when the workbook 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 Deactivate As WorkbookEvents_DeactivateEventHandler
'Usage
Dim instance As Workbook
Dim handler As WorkbookEvents_DeactivateEventHandler
AddHandler instance.Deactivate, handler
public event WorkbookEvents_DeactivateEventHandler Deactivate
public:
event WorkbookEvents_DeactivateEventHandler^ Deactivate {
void add (WorkbookEvents_DeactivateEventHandler^ value);
void remove (WorkbookEvents_DeactivateEventHandler^ value);
}
JScript does not support events.
Examples
The following code example demonstrates a handler for the Deactivate event. The event handler tiles all open Microsoft Office Excel windows when the workbook is deactivated.
This example is for a document-level customization.
Sub ThisWorkbook_Deactivate()
Me.Application.Windows.Arrange( _
Excel.XlArrangeStyle.xlArrangeStyleTiled)
End Sub
private void WorkbookDeactivate()
{
this.Deactivate +=
new Excel.WorkbookEvents_DeactivateEventHandler(
ThisWorkbook_Deactivate);
}
void ThisWorkbook_Deactivate()
{
this.Application.Windows.Arrange(Excel.XlArrangeStyle.xlArrangeStyleTiled,
missing, missing, missing);
}
.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.