Export (0) Print
Expand All

Workbook.SheetActivate Event

Occurs when any sheet is activated.

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

public event WorkbookEvents_SheetActivateEventHandler SheetActivate

The following code example demonstrates a handler for the SheetActivate event. The event handler displays the name of the worksheet that is activated.

private void WorkbookSheetActivate()
{
    this.SheetActivate +=
        new Excel.WorkbookEvents_SheetActivateEventHandler(
        ThisWorkbook_SheetActivate);
}

private void ThisWorkbook_SheetActivate(object Sh)
{
    Excel.Worksheet sheet = (Excel.Worksheet)Sh;
    MessageBox.Show(sheet.Name + " Activated");
}

Show:
© 2014 Microsoft