Share via


Workbook.WindowActivate Event (2007 System)

Occurs when any workbook window is activated.

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

Syntax

'Declaration
Public Event WindowActivate As WorkbookEvents_WindowActivateEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_WindowActivateEventHandler 

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

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

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace