ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add new workbook with new name (https://www.excelbanter.com/excel-programming/371855-add-new-workbook-new-name.html)

MarMo

Add new workbook with new name
 
Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo



Muhammed Rafeek M

Add new workbook with new name
 
try this way:

Sub TestWA() Workbooks.Add
ActiveWorkbook.SaveAs "Test.xls"
End Sub

pls do rate

"MarMo" wrote:

Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo




NickHK

Add new workbook with new name
 
Just save it with the required name.

NickHK

"MarMo" wrote in message
...
Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo





MarMo

Add new workbook with new name
 
thanks guys ,
Thanks for the suggestions. I tried saving it ,and it works fine.
But it's not what i'm looking for. What i'm asking is propably not possible.

When Excel opens a new book it does not save the book in a normal way.
It opens a book with the default name "Book1.xls".
As i'm adding up to 6 new workbooks with VBA in an excel application , Excel
opens Book1.xls to Book6.xls
What i'd like to do is , when adding a new book to assign a name to the new
opened book without saving it directly.
It's probably a stupid idea , but i'd like to know if it's possible.
Maybe i should save the workbooks to some folder and let the user decide
what to do with it.

Any other suggestions are welcome.
MarMo


"MarMo" wrote in message
...
Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo





[email protected]

Add new workbook with new name
 
Hi MarMo,

You have to save it first!, but you can do that by a *.xlt or template
file
Or you only want to ActiveWindow caption look only by :

ActiveWindow.caption = "Mybook"

Thanks,

Halim

MarMo menuliskan:
thanks guys ,
Thanks for the suggestions. I tried saving it ,and it works fine.
But it's not what i'm looking for. What i'm asking is propably not possible.

When Excel opens a new book it does not save the book in a normal way.
It opens a book with the default name "Book1.xls".
As i'm adding up to 6 new workbooks with VBA in an excel application , Excel
opens Book1.xls to Book6.xls
What i'd like to do is , when adding a new book to assign a name to the new
opened book without saving it directly.
It's probably a stupid idea , but i'd like to know if it's possible.
Maybe i should save the workbooks to some folder and let the user decide
what to do with it.

Any other suggestions are welcome.
MarMo


"MarMo" wrote in message
...
Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo




MarMo

Add new workbook with new name
 
Halim ,
This is exactly what i was looking for.
So i presume that whenever Excel opens a new book , it only changes the
caption ?
Thanks for this very much
MarMo


wrote in message
oups.com...
Hi MarMo,

You have to save it first!, but you can do that by a *.xlt or template
file
Or you only want to ActiveWindow caption look only by :

ActiveWindow.caption = "Mybook"

Thanks,

Halim

MarMo menuliskan:
thanks guys ,
Thanks for the suggestions. I tried saving it ,and it works fine.
But it's not what i'm looking for. What i'm asking is propably not
possible.

When Excel opens a new book it does not save the book in a normal way.
It opens a book with the default name "Book1.xls".
As i'm adding up to 6 new workbooks with VBA in an excel application ,
Excel
opens Book1.xls to Book6.xls
What i'd like to do is , when adding a new book to assign a name to the
new
opened book without saving it directly.
It's probably a stupid idea , but i'd like to know if it's possible.
Maybe i should save the workbooks to some folder and let the user decide
what to do with it.

Any other suggestions are welcome.
MarMo


"MarMo" wrote in message
...
Hi there ,
To add a new workbook with VBA the code is a follows :
Workbooks.add
This opens a new workbook with the default name book1.xls

Is there a way to alter the name when adding a new workbook ?
I'd like to add the name through my VBA code when adding a new book.

Thanks for any replies
MarMo







All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com