共用方式為


WorkbookBase.WindowDeactivate 事件

當停用任何活頁簿視窗時發生。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public Event WindowDeactivate As WorkbookEvents_WindowDeactivateEventHandler
public event WorkbookEvents_WindowDeactivateEventHandler WindowDeactivate

範例

下列程式碼會示範 WindowDeactivate 事件的處理常式。這個事件處理常式會將停用的活頁簿視窗最小化。

這是示範文件層級自訂的範例。

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 安全性

請參閱

參考

WorkbookBase 類別

Microsoft.Office.Tools.Excel 命名空間