Udostępnij za pośrednictwem


WorkbookBase.Open Event

Definition

Occurs when the workbook is opened.

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

Event Type

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.

private void WorkbookOpen()
{
    this.Open +=
        new Excel.WorkbookEvents_OpenEventHandler(
        ThisWorkbook_Open);
}

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

Applies to