Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't name new workbook
Is it possible to name a new workbook in VBA? I keep trying to, and get a
message that workbook.name is ready-only. If it's read-only, does that mean you can't name a workbook in VBA? I thought I had a long time ago, but I can't find the code in my library. Confused. wbNew.name = "Ted" <---Compile error. Can't assign to read-only property. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't name new workbook
You need to save it to give it a new name. Use
wbNew.SaveAs (Filename) "salgud" wrote: Is it possible to name a new workbook in VBA? I keep trying to, and get a message that workbook.name is ready-only. If it's read-only, does that mean you can't name a workbook in VBA? I thought I had a long time ago, but I can't find the code in my library. Confused. wbNew.name = "Ted" <---Compile error. Can't assign to read-only property. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't name new workbook
On Mon, 13 Apr 2009 13:09:01 -0700, Barb Reinhardt wrote:
You need to save it to give it a new name. Use wbNew.SaveAs (Filename) "salgud" wrote: Is it possible to name a new workbook in VBA? I keep trying to, and get a message that workbook.name is ready-only. If it's read-only, does that mean you can't name a workbook in VBA? I thought I had a long time ago, but I can't find the code in my library. Confused. wbNew.name = "Ted" <---Compile error. Can't assign to read-only property. Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't name new workbook
Yep, that is what the help files say. The workbook's name is its filename on
the hard disk, so you have to execute code that will change its name there. If the workbook is open, you should be able to use the SaveAs method like Barb posted. If it is not open, the you can rename the file on the disk using VB's Name..As statement. For example... Name "C:\Users\Rick\Documents\NewBook.xls" As "C:\Users\Rick\Documents\Ted.xls" assuming its current name is "NewBook". -- Rick (MVP - Excel) "salgud" wrote in message .. . Is it possible to name a new workbook in VBA? I keep trying to, and get a message that workbook.name is ready-only. If it's read-only, does that mean you can't name a workbook in VBA? I thought I had a long time ago, but I can't find the code in my library. Confused. wbNew.name = "Ted" <---Compile error. Can't assign to read-only property. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming | |||
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 | |||
What commands do you use to name a workbook, save a workbook,open a workbook | Excel Programming |