Share via


WorkbookBase.Deactivate Event

Definition

Occurs when the workbook is deactivated.

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

Event Type

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.

private void WorkbookDeactivate()
{
    this.Deactivate +=
        new Excel.WorkbookEvents_DeactivateEventHandler(
        ThisWorkbook_Deactivate);
}

void ThisWorkbook_Deactivate()
{
    this.Application.Windows.Arrange(Excel.XlArrangeStyle.xlArrangeStyleTiled);
}
Sub ThisWorkbook_Deactivate()
    Me.Application.Windows.Arrange( _
        Excel.XlArrangeStyle.xlArrangeStyleTiled)
End Sub

Applies to