Share via


Workbooks.Add Method

Creates a new workbook. The new workbook becomes the active workbook. Returns a Workbook object.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Add ( _
    Template As Object _
) As Workbook
'Usage
Dim instance As Workbooks
Dim Template As Object
Dim returnValue As Workbook

returnValue = instance.Add(Template)
Workbook Add(
    Object Template
)

Parameters

  • Template
    Type: System.Object

    Optional Object. Determines how the new workbook is created. If this argument is a string specifying the name of an existing Microsoft Excel file, the new workbook is created with the specified file as a template. If this argument is a constant, the new workbook contains a single sheet of the specified type. Can be one of the following XlWBATemplate constants: xlWBATChart, xlWBATExcel4IntlMacroSheet, xlWBATExcel4MacroSheet, or xlWBATWorksheet. If this argument is omitted, Microsoft Excel creates a new workbook with a number of blank sheets (the number of sheets is set by the SheetsInNewWorkbook property).

Return Value

Type: Microsoft.Office.Interop.Excel.Workbook

Remarks

If the Template argument specifies a file, the file name can include a path.

See Also

Reference

Workbooks Interface

Workbooks Members

Microsoft.Office.Interop.Excel Namespace