WorkbookBase.New Event

Definition

Occurs when a new workbook is created.

public event Microsoft.Office.Tools.Excel.WorkbookEvents_NewEventHandler New;

Event Type

WorkbookEvents_NewEventHandler

Examples

The following code example demonstrates a handler for the New event. The event handler maximizes the Microsoft Office Excel application window when a new workbook is created.

This example is for a document-level customization.

private void WorkbookNew()
{
    this.New +=
        new Microsoft.Office.Tools.Excel.WorkbookEvents_NewEventHandler(
        ThisWorkbook_New);
}

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

Applies to