Add Method (Workbooks Collection)

Applies To

Workbooks Collection.

Description

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

Syntax

object.Add(template)

object

Required. The Workbooks object.

template

Optional. 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 using the specified file as a template. If this argument is a constant (one of xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet), the new workbook contains a single sheet of the specified type. 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 filename may include a path.

See Also

ActiveWorkbook Property, SheetsInNewWorkbook Property.

Example

This example creates a new workbook.


Workbooks.Add