Share via


Worksheet.ActivateEvent Event (2007 System)

Occurs when the worksheet 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 ActivateEvent As DocEvents_ActivateEventHandler
'Usage
Dim instance As Worksheet 
Dim handler As DocEvents_ActivateEventHandler 

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

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

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace