Programmatically create new workbooks
When you create a workbook programmatically, it is a native Workbook object, not a Workbook host item.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Excel. For more information, see Features available by Office application and project type.
You can generate a Workbook host item for a Workbook object in VSTO Add-in project. For more information, see Extend Word documents and Excel workbooks in VSTO Add-ins at run time.
To create a new workbook
Use the Add method of the Workbooks collection.
Note
You can create a workbook based on a template other than the default template: pass the template you want to use as a parameter to the Add method.
Related content
- Extend Word documents and Excel workbooks in VSTO Add-ins at run time
- Add controls to Office documents at run time
- Work with workbooks
- How to: Programmatically open workbooks
- How to: Programmatically save workbooks
- How to: Programmatically close workbooks
- Programmatic limitations of host items and host controls
- Optional parameters in Office solutions
- Host items and host controls overview