Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"