WorkbookBase.WindowDeactivate Event

 

Occurs when any workbook window is deactivated.

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

public event WorkbookEvents_WindowDeactivateEventHandler WindowDeactivate

The following code example demonstrates a handler for the WindowDeactivate event. The event handler minimizes the workbook window that was deactivated.

This example is for a document-level customization.

private void WorkbookWindowDeactivate()
{
    this.WindowDeactivate +=
        new Excel.WorkbookEvents_WindowDeactivateEventHandler(
        ThisWorkbook_WindowDeactivate);
}

private void ThisWorkbook_WindowDeactivate(Excel.Window Wn)
{
    Wn.WindowState = Excel.XlWindowState.xlMinimized;
}
Return to top
Show: