Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
guys,
In VBA I am adding a new workbook to an XL application object. I would like to name the new workbook either at the time it is added to the workbooks collection or after it is added however, even though the VBA help file says the "Name" property of a Workbook "returns or sets the name of the object", it appears to be read-only. For reference a snippet of my code is: Xl.Workbooks.Add BookNum = Xl.Workbooks.Count Xl.Workbooks(BookNum).Name = "bob" The last line fails with a run-time error - wrong number of arguments or invalid property assignment. Is there a way to name a new workbook or rename an existing one other than doing so via Save As? John Project MVP |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
A workbook is named as part of the save or saveas operation. Try: XL.Workbooks.Add ActiveWorkbook.SaveAs "Bob", xlWorkbookNormal --- Regards, Norman "John" wrote in message ... guys, In VBA I am adding a new workbook to an XL application object. I would like to name the new workbook either at the time it is added to the workbooks collection or after it is added however, even though the VBA help file says the "Name" property of a Workbook "returns or sets the name of the object", it appears to be read-only. For reference a snippet of my code is: Xl.Workbooks.Add BookNum = Xl.Workbooks.Count Xl.Workbooks(BookNum).Name = "bob" The last line fails with a run-time error - wrong number of arguments or invalid property assignment. Is there a way to name a new workbook or rename an existing one other than doing so via Save As? John Project MVP |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In article ,
"Norman Jones" wrote: Hi John, A workbook is named as part of the save or saveas operation. Try: XL.Workbooks.Add ActiveWorkbook.SaveAs "Bob", xlWorkbookNormal --- Regards, Norman Norman, Thanks. I was hoping I could name the new workbook when it was created, (as is possible with a Worksheet), but I essentially ended up using the suggestion you gave. John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select sheet tabs in workbook & save to separate workbook files | Excel Worksheet Functions | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
Copy a range of cells in an unopened workbook and paste it to the current workbook | Excel Programming | |||
Open a password protected excel workbook from second workbook to fetch data using dynamic connection | Excel Programming | |||
What commands do you use to name a workbook, save a workbook,open a workbook | Excel Programming |