Udostępnij za pośrednictwem


Workbook.Open Event (2007 System)

Occurs when the workbook is opened.

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

Syntax

'Declaration
Public Event Open As WorkbookEvents_OpenEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_OpenEventHandler 

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

Examples

The following code example demonstrates a handler for the Open event. The event handler maximizes the Microsoft Office Excel application window when the current workbook is opened.

This example is for a document-level customization.

Sub ThisWorkbook_Open() Handles Me.Open
    Me.Application.WindowState = Excel.XlWindowState.xlMaximized
End Sub
private void WorkbookOpen()
{
    this.Open +=
        new Excel.WorkbookEvents_OpenEventHandler(
        ThisWorkbook_Open);
}

void ThisWorkbook_Open()
{
    this.Application.WindowState = Excel.XlWindowState.xlMaximized;
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace