This topic has not yet been rated - Rate this topic

Workbook.ActivateEvent Event

Occurs when the workbook is activated.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public event WorkbookEvents_ActivateEventHandler ActivateEvent

When you switch between two windows showing the same workbook, the WindowActivate event occurs, but the ActivateEvent event for the workbook does not occur.

This event does not occur when you create a new window.

The following code example demonstrates a handler for the ActivateEvent event. The event handler displays worksheet Sheet1 when the workbook is activated.

private void WorkbookActivateEvent()
{
    this.ActivateEvent +=
        new Excel.WorkbookEvents_ActivateEventHandler(
        ThisWorkbook_ActivateEvent);
}

private void ThisWorkbook_ActivateEvent()
{
    Globals.Sheet1.Activate();
}

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.