Bagikan melalui


WorksheetBase.ActivateEvent Event

Definition

Occurs when the worksheet is activated.

public:
 event Microsoft::Office::Interop::Excel::DocEvents_ActivateEventHandler ^ ActivateEvent;
public event Microsoft.Office.Interop.Excel.DocEvents_ActivateEventHandler ActivateEvent;
member this.ActivateEvent : Microsoft.Office.Interop.Excel.DocEvents_ActivateEventHandler 
Public Custom Event ActivateEvent As DocEvents_ActivateEventHandler 

Event Type

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.

private void WorksheetActivateEvent()
{
    this.ActivateEvent += 
        new Excel.DocEvents_ActivateEventHandler(
        Worksheet1_ActivateEvent);
}

void Worksheet1_ActivateEvent()
{
    MessageBox.Show(this.Name + " was activated.");
}
Sub Worksheet1_ActivateEvent() Handles Me.ActivateEvent
    MsgBox(Me.Name & " was activated.")
End Sub

Applies to