Dela via


Worksheet.Startup Event (2007 System)

Occurs after the worksheet is running and all the initialization code in the assembly has been run.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event Startup As EventHandler
'Usage
Dim instance As Worksheet 
Dim handler As EventHandler 

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

Remarks

The last thing to run in the constructor of the class that the user code is running in.

Examples

The following code example demonstrates a handler for the Startup event that displays a message when the worksheet has been initialized.

This example is for a document-level customization.

Private Sub Worksheet1_Startup(ByVal sender As Object, ByVal e As EventArgs) _
    Handles Me.Startup
    MsgBox(Me.Name & " is starting up.")
End Sub
private void WorksheetStartup()
{
    this.Startup += new EventHandler(Worksheet1_Startup);
}

void Worksheet1_Startup(object sender, EventArgs e)
{
    MessageBox.Show(this.Name + " is starting up.");
}

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace