Share via


WorkbookBase.WindowDeactivate Event

Definition

Occurs when any workbook window is deactivated.

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

Event Type

Examples

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;
}
Private Sub ThisWorkbook_WindowDeactivate(ByVal Wn As Excel.Window) _
    Handles Me.WindowDeactivate
    Wn.WindowState = Excel.XlWindowState.xlMinimized
End Sub

Applies to