MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Specify name of new workbook

Posted by John on March 22, 2000 1:20 AM

I need to create a new workbook of a specific name ("List Items").

When I use the Workbooks.Add command, I get a new book called Book2 (or Book3 etc).

Is there any way that I can create a new workbook and specify the name without saving it first?


Posted by Celia on March 23, 2000 4:44 PM

You can get the code you are looking for by using the macro recorder to record your actions.
As the famous Bill Roberts is aware, the recorder can be a very useful tool to ascertain code required to write macros.
A slimmed down version of what the macro recorder will produce is :-

ActiveWorkbook.SaveAs Filename:="C:\ListItems.xls"


Posted by John on March 24, 2000 6:46 AM


I don't want to save the newly created workbook, just create it so that I can put data into it automatically. The end user will then choose whether or not to save the file.

Is this possible?


Posted by Celia on March 24, 2000 1:04 PM

The only way I can think of is to have a template called “List Items” and replace the line Workbooks.Add with :-

Workbooks.Open Filename:="C:\List Items.xlt", Editable:=False