Create and Save a new workbook
How to create and save a new workbook using VBA
Sub Create_and_Save_Workbook()
'declare a variable
Dim wb As Workbook
Dim wb As Workbook
Set wb = Workbooks.Add
'create and save a new workbook
FileToSaveName = Application.GetSaveAsFilename(InitialFileName:="Default Name", filefilter:="Excel Files(*.xlsx),*.xlsx,Excel-Macro Files (*.xlsm),*.xlsm")
FileToSaveName = Application.GetSaveAsFilename(InitialFileName:="Default Name", filefilter:="Excel Files(*.xlsx),*.xlsx,Excel-Macro Files (*.xlsm),*.xlsm")
wb.SaveAs FileToSaveName
End Sub
ADDITIONAL NOTES
Note 1: This VBA code will display a Save As dialog box where you can enter a name the new Excel file, select the file type and choose the location where you want to save the file.
Note 1: This VBA code will display a Save As dialog box where you can enter a name the new Excel file, select the file type and choose the location where you want to save the file.
EXPLANATION
This tutorial explains and provides step by step instructions on how to create and save a new Excel file using VBA.
This tutorial explains and provides step by step instructions on how to create and save a new Excel file using VBA.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Create a new Excel workbook | How to create a new excel file (workbook) using Excel, VBA and Shortcut methods | |
Save an Excel workbook | How to save a workbook using Excel, VBA and Shortcut methods | |
Open an Excel workbook | How to open a single workbook using Excel, VBA and Shortcut methods | |
Save and close an Excel workbook | How to save and close a workbook using VBA | |
Save Excel workbook without being prompted | How to save an Excel workbook without being prompted using VBA |