Excel Reference

Create a Workbook

To create a workbook in Visual Basic, use the Add method. The following procedure creates a workbook. Microsoft Excel automatically names the workbook Book _N_, where _N_ is the next available number. The new workbook becomes the active workbook.

vb Sub AddOne() Workbooks.Add End Sub

A better way to create a workbook is to assign it to an object variable. In the following example, the Workbook object returned by the Add method is assigned to an object variable, newBook. Next, several properties of newBook are set. You can easily control the new workbook by using the object variable.

vb Sub AddNew() Set NewBook = Workbooks.Add With NewBook .Title = "All Sales" .Subject = "Sales" .SaveAs Filename:="Allsales.xls" End With End Sub

!include[Support and feedback]

Other Create members in Excel (7)

6 community Q&A using Create a Workbook

Libraries that work with Create (5)

125 wordsMicrosoft Docs rev. 06/08/2017