WorkbookBase.WindowActivate Event

Occurs when any workbook window is activated.

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 WindowActivate As WorkbookEvents_WindowActivateEventHandler
public event WorkbookEvents_WindowActivateEventHandler WindowActivate

Examples

The following code example demonstrates a handler for the WindowActivate event. The event handler maximizes the workbook window that was activated.

This example is for a document-level customization.

Private Sub ThisWorkbook_WindowActivate(ByVal Wn As Excel.Window) _
    Handles Me.WindowActivate
    Wn.WindowState = Excel.XlWindowState.xlMaximized
End Sub
private void WorkbookWindowActivate()
{
    this.WindowActivate +=
        new Excel.WorkbookEvents_WindowActivateEventHandler(
        ThisWorkbook_WindowActivate);
}

private void ThisWorkbook_WindowActivate(Excel.Window Wn)
{
    Wn.WindowState = Excel.XlWindowState.xlMaximized;
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace