Partager via


WorkbookBase.Deactivate Event

Occurs when the workbook is deactivated.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public Event Deactivate As WorkbookEvents_DeactivateEventHandler
public event WorkbookEvents_DeactivateEventHandler Deactivate

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);
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace