30 Advanced Excel Tips for 2026

Excel Champs / VBA / VBA Create New Workbook (Excel File)
By Puneet Gogia (Microsoft MVP)

VBA Create New Workbook (Excel File)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

Use Workbooks.Add. It creates a new, unsaved workbook and makes it the active one. Store it in a variable so the rest of the code points at the right file:

Sub CreateWorkbook()
    Dim wb As Workbook
    Set wb = Workbooks.Add
    wb.Worksheets(1).Range("A1").Value = "Report"
    wb.SaveAs Filename:="C:\Reports\Sales.xlsx", FileFormat:=xlOpenXMLWorkbook
End Sub

The new file gets the number of sheets set in File → Options → General → Include this many sheets. For a single sheet of a set type, pass a constant to the Template argument: Workbooks.Add xlWBATWorksheet for one worksheet, or Workbooks.Add xlWBATChart for one chart sheet.

To start from an existing file’s layout, pass its path as the template: Workbooks.Add Template:="C:\Templates\Invoice.xlsx". The new workbook copies that file’s sheets, formatting and formulas, and the original stays unchanged.

Match the extension to FileFormat when saving. Use .xlsx with xlOpenXMLWorkbook, and .xlsm with xlOpenXMLWorkbookMacroEnabled. A mismatch, such as a .xlsm name with no file format given, stops the macro with error 1004.

If a file with that name already exists, Excel asks whether to replace it, and clicking No stops the macro with error 1004. Check first with If Dir("C:\Reports\Sales.xlsx") <> "" Then, or set Application.DisplayAlerts = False before saving to overwrite without the prompt.

Create a New Workbook (File) - Excel VBA Tutorial
Video on how to create a new workbook using macro.

To create a new workbook using VBA, you need to use the “Workbooks.Add” method. When you use this method, it inserts a new workbook (without saving it) and activates it after that. It works like when you press the keyboard shortcut CONTROL + N. You can also use a template to insert a new workbook.

Create a New Workbook using VBA

You can open the VBE from the developer tab (add it to the ribbon if you don’t see it) or press Alt + F11, and then enter this code into the VBE.

  1. Type the keyword “Workbooks” to refer to the workbook object.
  2. After that, type a dot.
  3. Here you’ll have a list of properties and methods to select.
  4. Select “Add” from that list or type it.
Sub vba_new_workbook()
Workbooks.Add
End Sub
add-a-new-workbook-using-a-template

Add a New Workbook using a Template

As I said, we are using the Workbooks.Add method. With this method, there’s an argument (optional) that you can use to refer to a file as a template.

Workbooks.Add (Template)  ' Template is optional

Let’s say you have a workbook and want the new workbook to be exactly the same as it. In that case, you can refer to it as a template.

Workbooks.Add Template:="C:\Users\Dell\Desktop\book1.xlsx"

When you run the above code, it takes the reference from the “book1” which is saved on the desktop. The template workbook has 6 worksheets, and the new workbook has exactly the same worksheets (with the same content).

the-template-workbook

Apart from this, instead of a file, you can use one of the following constants as the Template argument. Then the new workbook has a single sheet of that type.

  1. xlWBATChart: Chart Sheet
  2. xlWBATExcel4IntlMacroSheet: Macro Sheet (International) Version 4
  3. xlWBATExcel4MacroSheet: Macro Sheet Version 4
  4. xlWBATWorksheet: Worksheet

For example, the following code creates a new workbook with just one worksheet:

Sub new_workbook_one_sheet()
Workbooks.Add xlWBATWorksheet
End Sub

Create a New Excel Workbook and Save it

When you create a new workbook with the Add method, Excel opens it but doesn’t save it. So for this, you need to use the SaveAs method.

create-a-new-excel-worksheet
Sub vba_create_workbook()
Workbooks.Add
ActiveWorkbook.SaveAs "C:\users\dell\desktop\myBook.xlsx"
End Sub
  1. First, use Workbooks.Add to create a new workbook.
  2. Next, refer to the active workbook and use the SaveAs method.
  3. In the SaveAs method, use the path where you want to save the workbook along with the name of the file.
  4. In the end, run the code.

If a file with the same name is already in that folder, Excel asks if you want to replace it, and if you click No, the code stops with run-time error 1004. To replace the file without the prompt, turn off alerts while saving.

Store the New Workbook in a Variable

ActiveWorkbook works, but it’s safer to store the new workbook in a variable, as Workbooks.Add returns the workbook it creates. Then you can work with it even if another workbook gets activated. The following code creates a workbook, adds a value, saves it as an .xlsx file and closes it:

Sub create_save_close_workbook()
Dim wb As Workbook
Set wb = Workbooks.Add
wb.Sheets(1).Range("A1").Value = "Report"
Application.DisplayAlerts = False
wb.SaveAs Filename:="C:\Users\Dell\Desktop\Report.xlsx", FileFormat:=xlOpenXMLWorkbook
Application.DisplayAlerts = True
wb.Close SaveChanges:=False
End Sub

FileFormat:=xlOpenXMLWorkbook saves it as a regular .xlsx file. Use xlOpenXMLWorkbookMacroEnabled for an .xlsm file if the workbook needs to keep macros.

Frequently Asked Questions

How many sheets does a new workbook have?

As many as the “Include this many sheets” setting in File ➜ Options ➜ General. In VBA, you can change it with Application.SheetsInNewWorkbook before you use Workbooks.Add.

Can I create a new workbook without showing it?

The new workbook always becomes the active one. You can turn off screen updating while the code runs, and then activate your original workbook again with ThisWorkbook.Activate.

What name does a new workbook get?

A temporary name like Book2 or Book3 until you save it. The real file name comes from SaveAs.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel