Udostępnij za pośrednictwem


Workbook.Startup Event (2007 System)

Occurs after the workbook 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 Workbook 
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. Use this event for any additional initialization.

Examples

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

This example is for a document-level customization.

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

void ThisWorkbook1_Startup(object sender, EventArgs e)
{
    MessageBox.Show("The workbook is starting up");
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace