Dela via


Workbook.WindowDeactivate Event (2007 System)

Occurs when any workbook window is deactivated.

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

Syntax

'Declaration
Public Event WindowDeactivate As WorkbookEvents_WindowDeactivateEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_WindowDeactivateEventHandler 

AddHandler instance.WindowDeactivate, handler
public event WorkbookEvents_WindowDeactivateEventHandler WindowDeactivate
public:
 event WorkbookEvents_WindowDeactivateEventHandler^ WindowDeactivate {
    void add (WorkbookEvents_WindowDeactivateEventHandler^ value);
    void remove (WorkbookEvents_WindowDeactivateEventHandler^ value);
}
JScript does not support events.

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

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace