Adding New Woıkbook with a specific name

T

Tolga & Hande

We want to add a new workbook in the VB but with a
specific name. We know to use "Workbooks.Add" command
but do not know how to specify name. We also can solve
it with save as as soon as we add it. But want to know
if there is a single command to do that.
 
R

Ron de Bruin

Try this

Dim wb As Workbook
Set wb = Workbooks.Add
wb.SaveAs "C:\test.xls"
 
J

Jake Marx

Hi Tolga & Hande,

Saving the workbook is the only way to name it. You can do it in one
statement if you'd like:

Workbooks.Add.SaveAs "C:\test.xls"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top