Share via


WorksheetBase.ActivateEvent Event

Occurs when the worksheet 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 ActivateEvent As DocEvents_ActivateEventHandler
public event DocEvents_ActivateEventHandler ActivateEvent

Examples

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

This example is for a document-level customization.

Sub Worksheet1_ActivateEvent() Handles Me.ActivateEvent
    MsgBox(Me.Name & " was activated.")
End Sub
private void WorksheetActivateEvent()
{
    this.ActivateEvent += 
        new Excel.DocEvents_ActivateEventHandler(
        Worksheet1_ActivateEvent);
}

void Worksheet1_ActivateEvent()
{
    MessageBox.Show(this.Name + " was activated.");
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace