WorkbookBase.Open Event

Occurs when the workbook is opened.

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

Syntax

'Declaration
Public Event Open As WorkbookEvents_OpenEventHandler
public event WorkbookEvents_OpenEventHandler Open

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

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace