Microsoft Excel Training Videos


Creating a new workbook using VBA in Excel

A good way to create a new workbook in Microsoft Excel is to assign it to an object variable. In the following example, the Excel 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 Excel workbook using the object variable. The Excel training video shows how to create a new workbook and demonstrates how the set properties can be viewed.



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


Links
Add and save a new work book using VBA in Excel

Creating workbook: VBA