Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.dotnet.languages.vb,microsoft.public.vb.ole.automation,microsoft.public.vb.ole
|
|||
|
|||
![]()
My VB.NET program pops up an Excel workbook for the user. If I
initially create the workbook using: Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBA Template.xlWBATWorksheet) I end up with a workbook named "sheet1". If I use an existing Excel file as a template, e.g.: Workbooks.Add("C:\temp\MyTemplateFile.xls") I end up with a workbook named "MyTemplateFile1". Neither name is particularly appropriate, so I want to find a way to set the workbook name myself when I first create the file. You can always *get* the name using the Name property, but that property is read-only, so you can't set the name that way. I can of course save the file, using the SaveAs method, and set the name to something new in the process. But I don't want to save the file myself -- I want the user to look at the file, decide whether he wants to keep it, and then decide where and under what name to save it. I just want to give him an appropriate name to start with; but if he doesn't like what he sees I would prefer the file never be saved at all. BTW, I think I can understand why you can't set the Name property after the workbook has been created. While this would make sense if -- as in my case -- the file exists only in memory, I can see where it could give you problems if you are working with a file that has already been saved to disk with a particular name. But I don't see why I should be forced to accept an arbitrary default name when no file yet exists on disk! -- John Brock |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
in excel how to get initial from name | New Users to Excel | |||
How do I set initial Excel workbook name? | Excel Discussion (Misc queries) | |||
How can I have an initial zero in an Excel cell? | Excel Discussion (Misc queries) | |||
Format fonts (ie, initial cap) in Excel like you can in Word. | Excel Discussion (Misc queries) | |||
Saving Multiple Sheets to Another Spreadsheet Without Leaving the Initial Workbook | Excel Programming |