Partilhar via


WorkbookBase.New Event

Occurs when a new workbook is created.

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 New As WorkbookEvents_NewEventHandler
public event WorkbookEvents_NewEventHandler New

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.

Sub ThisWorkbook_New() Handles Me.New 
    Me.Application.WindowState = Excel.XlWindowState.xlMaximized
End Sub
private void WorkbookNew()
{
    this.New +=
        new Microsoft.Office.Tools.Excel.WorkbookEvents_NewEventHandler(
        ThisWorkbook_New);
}

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

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace