How to: Create New Workbooks
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

How to: Create New Workbooks


Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

The Workbooks collection in Microsoft Office Excel 2003 makes it possible to create a new workbook, and import data into a new workbook. However, since you add the workbook programmatically, it is a native Microsoft.Office.Interop.Excel.Workbook object and does not have the additional events and data-binding capabilities of a Microsoft.Office.Tools.Excel.Workbook host item.

To create a new workbook

  • Use the Add method of the Workbooks collection.

    Excel.Workbook newWorkbook = this.Application.Workbooks.Add(missing);

You can also specify the name of a workbook template as a parameter to the Add method.

See Also

© 2016 Microsoft