Adding and Saving Workbooks
The following code will prompt the user for the name of a workbook. It will then create and save a new
workbook with the same name.
Private Sub CommandButton1_Click() Dim Workbook_Name As String Dim New_Workbook As Workbook Set New_Workbook = Nothing Workbook_Name = InputBox(Prompt:="Workbook Name.", Title:="Enter the WorkBook Name :") Set New_Workbook = Workbooks.Add With New_Workbook .Activate .SaveAs Workbook_Name End With End Sub
To download the .XLSM file for this article, click here
Can't get the tutorial to work for you? Need help with your code?
Get answers right away at our AE Excel Support Forums!
Get answers right away at our AE Excel Support Forums!



GetSaveAsFileName is a much more powerful way to get a file name from a user. It allows browsing to a desired directory with the familiar “Save” dialog.
Please send me GetSaveAsFileName code, assuming it is a freebie.
Thanks!
Pam