Partilhar via


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)

Syntax

'Declaration
Public Event WindowDeactivate As WorkbookEvents_WindowDeactivateEventHandler
public event WorkbookEvents_WindowDeactivateEventHandler WindowDeactivate

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 Sub ThisWorkbook_WindowDeactivate(ByVal Wn As Excel.Window) _
    Handles Me.WindowDeactivate
    Wn.WindowState = Excel.XlWindowState.xlMinimized
End Sub
private void WorkbookWindowDeactivate()
{
    this.WindowDeactivate +=
        new Excel.WorkbookEvents_WindowDeactivateEventHandler(
        ThisWorkbook_WindowDeactivate);
}

private void ThisWorkbook_WindowDeactivate(Excel.Window Wn)
{
    Wn.WindowState = Excel.XlWindowState.xlMinimized;
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace