How to: Programmatically create new workbooks
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
Excel.Workbook newWorkbook = this.Application.Workbooks.Add();
Dim newWorkbook As Excel.Workbook = Me.Application.Workbooks.Add()
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.
- 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