Partager via


WorkbookBase.New Event

Definition

Occurs when a new workbook is created.

public:
 event Microsoft::Office::Tools::Excel::WorkbookEvents_NewEventHandler ^ New;
public event Microsoft.Office.Tools.Excel.WorkbookEvents_NewEventHandler New;
member this.New : Microsoft.Office.Tools.Excel.WorkbookEvents_NewEventHandler 
Public Custom Event New As WorkbookEvents_NewEventHandler 

Event Type

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