Add Method (Workbooks Collection)

Applies To

Workbooks collection object.

Description

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

Syntax

expression.Add(Template)

expression Required. An expression that returns a Workbooks object.

Template Optional Variant. 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).

Remarks

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

See Also

ActiveWorkbook property, SheetsInNewWorkbook property.

Example

This example creates a new workbook.

Workbooks.Add