 |
|
|
|
| Author |
Message |
John Brock
Joined: 04 Oct 2007 Posts: 13
|
Posted: Thu Feb 15, 2007 10:52 pm Post subject: How do I set initial Excel workbook name? |
|
|
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.XlWBATemplate.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
jbrock@panix.com
Archived from group: microsoft>public>excel>misc |
|
| Back to top |
|
 |
Joel
Joined: 04 Oct 2007 Posts: 2
|
Posted: Thu Feb 15, 2007 3:36 pm Post subject: RE: How do I set initial Excel workbook name? |
|
|
How about after the workbook is opened
Workbooks(ThisWorkbook.Name).name = "My New workbook Name"
"John Brock" wrote:
> 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.XlWBATemplate.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
> jbrock@panix.com
>
> |
|
| Back to top |
|
 |
RobinS
Joined: 04 Oct 2007 Posts: 13
|
Posted: Thu Feb 15, 2007 3:41 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
The [name] property of the worksheet is *not* read-only. It is a property
of the worksheet. This property is what's displayed in the tab at the
bottom of a workbook.
I've used this in my code:
xlSheet = CType(xlBook.WorkSheets(1), Excel.WorkSheet)
xlSheet.Activate()
xlSheet.Name = "blah blah"
xlBook is my current workbook.
Robin S.
-----------------------------------------
"John Brock" wrote in message $c5m$1@reader2.panix.com...
> 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.XlWBATemplate.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
> jbrock@panix.com
> |
|
| Back to top |
|
 |
Charles Williams
Joined: 04 Oct 2007 Posts: 1
|
Posted: Thu Feb 15, 2007 11:55 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
John,
Your analysis is correct: there is no way of changing the name of a workbook
except by Saveas etc.
IMHO leaving the name of the book as Book1 is the best approach because the
user is more likely to recognise this as the name of a new unsaved workbook.
Thats what I usually do, and then I give any sheets I generate within the
workbook meaningful names.
regards
Charles
______________________
Decision Models
FastExcel 2.3 now available
Name Manager 4.0 now available
www.DecisionModels.com |
|
| Back to top |
|
 |
Dave Peterson
Joined: 04 Oct 2007 Posts: 5
|
Posted: Thu Feb 15, 2007 7:28 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
Maybe you could rename the template file to something more significant before
you use it as the basis of your new workbook.
Then rename it back (or just leave it with the new nice name).
John Brock wrote:
>
> 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.XlWBATemplate.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
> jbrock@panix.com
--
Dave Peterson |
|
| Back to top |
|
 |
RobinS
Joined: 04 Oct 2007 Posts: 13
|
Posted: Thu Feb 15, 2007 8:55 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
You're right; I missed that he was looking at the workbook instead of the
worksheet.
Robin S.
----------------------------
"Charles Williams" wrote in message
news:%23O2BULTUHHA.1208@TK2MSFTNGP03.phx.gbl...
> John,
>
> Your analysis is correct: there is no way of changing the name of a
> workbook except by Saveas etc.
>
> IMHO leaving the name of the book as Book1 is the best approach because
> the user is more likely to recognise this as the name of a new unsaved
> workbook. Thats what I usually do, and then I give any sheets I generate
> within the workbook meaningful names.
>
> regards
> Charles
> ______________________
> Decision Models
> FastExcel 2.3 now available
> Name Manager 4.0 now available
> www.DecisionModels.com
> |
|
| Back to top |
|
 |
John Brock
Joined: 04 Oct 2007 Posts: 13
|
Posted: Fri Feb 16, 2007 10:41 am Post subject: Re: How do I set initial Excel workbook name? |
|
|
Here is one problem: Let's say I pick a nice new temporary name
for my template file, say, "BudgetReport.xls". When I create the
file the user will see it as "BudgetReport1", and when he saves it
the suggested name will be "BudgetReport1.xls". The user gets to
modify the name, so maybe he gets rid of that pointless "1". No
problem so far, but what if he runs the program again? This time
I can't rename my template file, because that nice new name is
already taken! I could code around that, and temporarily rename
both files, but frankly it's not a big enough problem to be worth
the bother.
Still, I think it's surprising that Microsoft doesn't allow the
programmer to control such a visible piece of text. The obvious
solution would be an optional parameter to the Add method, i.e.:
Workbooks.Add("C:\temp\MyTemplateFile.xls", Name:="BudgetReport")
I don't see any way this could cause any problems -- any Microsofties
out there listening?
In article ,
Dave Peterson wrote:
>Maybe you could rename the template file to something more significant before
>you use it as the basis of your new workbook.
>
>Then rename it back (or just leave it with the new nice name).
>John Brock wrote:
>>
>> 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.XlWBATemplate.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
jbrock@panix.com |
|
| Back to top |
|
 |
Dave Peterson
Joined: 04 Oct 2007 Posts: 5
|
Posted: Fri Feb 16, 2007 1:38 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
I doubt that anyone from MS will find your message and read it.
This is usually users helping users--every once in awhile, you'll see someone
from MS, but it's pretty rare.
Maybe you could add code that saves the file (or just prompts the user to save
the file) as soon as you create the file???
Then you can use any name you or the user wants.
John Brock wrote:
>
> Here is one problem: Let's say I pick a nice new temporary name
> for my template file, say, "BudgetReport.xls". When I create the
> file the user will see it as "BudgetReport1", and when he saves it
> the suggested name will be "BudgetReport1.xls". The user gets to
> modify the name, so maybe he gets rid of that pointless "1". No
> problem so far, but what if he runs the program again? This time
> I can't rename my template file, because that nice new name is
> already taken! I could code around that, and temporarily rename
> both files, but frankly it's not a big enough problem to be worth
> the bother.
>
> Still, I think it's surprising that Microsoft doesn't allow the
> programmer to control such a visible piece of text. The obvious
> solution would be an optional parameter to the Add method, i.e.:
>
> Workbooks.Add("C:\temp\MyTemplateFile.xls", Name:="BudgetReport")
>
> I don't see any way this could cause any problems -- any Microsofties
> out there listening?
>
> In article ,
> Dave Peterson wrote:
> >Maybe you could rename the template file to something more significant before
> >you use it as the basis of your new workbook.
> >
> >Then rename it back (or just leave it with the new nice name).
>
> >John Brock wrote:
> >>
> >> 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.XlWBATemplate.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
> jbrock@panix.com
--
Dave Peterson |
|
| Back to top |
|
 |
RobinS
Joined: 04 Oct 2007 Posts: 13
|
Posted: Fri Feb 16, 2007 1:57 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
MS only answers q's in the dotnet newsgroups for its MSDN subscribers.
Just FYI.
Robin S.
--------------------
"Dave Peterson" wrote in message @verizonXSPAM.net...
>I doubt that anyone from MS will find your message and read it.
>
> This is usually users helping users--every once in awhile, you'll see
> someone
> from MS, but it's pretty rare.
>
> Maybe you could add code that saves the file (or just prompts the user to
> save
> the file) as soon as you create the file???
>
> Then you can use any name you or the user wants.
>
> John Brock wrote:
>>
>> Here is one problem: Let's say I pick a nice new temporary name
>> for my template file, say, "BudgetReport.xls". When I create the
>> file the user will see it as "BudgetReport1", and when he saves it
>> the suggested name will be "BudgetReport1.xls". The user gets to
>> modify the name, so maybe he gets rid of that pointless "1". No
>> problem so far, but what if he runs the program again? This time
>> I can't rename my template file, because that nice new name is
>> already taken! I could code around that, and temporarily rename
>> both files, but frankly it's not a big enough problem to be worth
>> the bother.
>>
>> Still, I think it's surprising that Microsoft doesn't allow the
>> programmer to control such a visible piece of text. The obvious
>> solution would be an optional parameter to the Add method, i.e.:
>>
>> Workbooks.Add("C:\temp\MyTemplateFile.xls", Name:="BudgetReport")
>>
>> I don't see any way this could cause any problems -- any Microsofties
>> out there listening?
>>
>> In article ,
>> Dave Peterson wrote:
>> >Maybe you could rename the template file to something more significant
>> >before
>> >you use it as the basis of your new workbook.
>> >
>> >Then rename it back (or just leave it with the new nice name).
>>
>> >John Brock wrote:
>> >>
>> >> 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.XlWBATemplate.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
>> jbrock@panix.com
>
> --
>
> Dave Peterson |
|
| Back to top |
|
 |
Dave Peterson
Joined: 04 Oct 2007 Posts: 5
|
Posted: Fri Feb 16, 2007 4:08 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
Every once in awhile, there'll be a response from MS employees. But it's pretty
rare (at least in the .public excel newsgroups).
RobinS wrote:
>
> MS only answers q's in the dotnet newsgroups for its MSDN subscribers.
>
> Just FYI.
> Robin S.
> --------------------
> "Dave Peterson" wrote in message
> @verizonXSPAM.net...
> >I doubt that anyone from MS will find your message and read it.
> >
> > This is usually users helping users--every once in awhile, you'll see
> > someone
> > from MS, but it's pretty rare.
> >
> > Maybe you could add code that saves the file (or just prompts the user to
> > save
> > the file) as soon as you create the file???
> >
> > Then you can use any name you or the user wants.
> >
> > John Brock wrote:
> >>
> >> Here is one problem: Let's say I pick a nice new temporary name
> >> for my template file, say, "BudgetReport.xls". When I create the
> >> file the user will see it as "BudgetReport1", and when he saves it
> >> the suggested name will be "BudgetReport1.xls". The user gets to
> >> modify the name, so maybe he gets rid of that pointless "1". No
> >> problem so far, but what if he runs the program again? This time
> >> I can't rename my template file, because that nice new name is
> >> already taken! I could code around that, and temporarily rename
> >> both files, but frankly it's not a big enough problem to be worth
> >> the bother.
> >>
> >> Still, I think it's surprising that Microsoft doesn't allow the
> >> programmer to control such a visible piece of text. The obvious
> >> solution would be an optional parameter to the Add method, i.e.:
> >>
> >> Workbooks.Add("C:\temp\MyTemplateFile.xls", Name:="BudgetReport")
> >>
> >> I don't see any way this could cause any problems -- any Microsofties
> >> out there listening?
> >>
> >> In article ,
> >> Dave Peterson wrote:
> >> >Maybe you could rename the template file to something more significant
> >> >before
> >> >you use it as the basis of your new workbook.
> >> >
> >> >Then rename it back (or just leave it with the new nice name).
> >>
> >> >John Brock wrote:
> >> >>
> >> >> 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.XlWBATemplate.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
> >> jbrock@panix.com
> >
> > --
> >
> > Dave Peterson
--
Dave Peterson |
|
| Back to top |
|
 |
RobinS
Joined: 04 Oct 2007 Posts: 13
|
Posted: Fri Feb 16, 2007 2:26 pm Post subject: Re: How do I set initial Excel workbook name? |
|
|
Yes, you're right, I have seen one guy (Nick?) who's a MSFT employee who
answers in the groups, but not *because* he's a MSFT employee. But the ones
that people see from Linda Liu and Wen whatshisname are because people are
paying for the privilege of getting answers in the managed newsgroups.
Robin S.
-----------------------------
"Dave Peterson" wrote in message @verizonXSPAM.net...
> Every once in awhile, there'll be a response from MS employees. But it's
> pretty
> rare (at least in the .public excel newsgroups).
>
> RobinS wrote:
>>
>> MS only answers q's in the dotnet newsgroups for its MSDN subscribers.
>>
>> Just FYI.
>> Robin S.
>> --------------------
>> "Dave Peterson" wrote in message
>> @verizonXSPAM.net...
>> >I doubt that anyone from MS will find your message and read it.
>> >
>> > This is usually users helping users--every once in awhile, you'll see
>> > someone
>> > from MS, but it's pretty rare.
>> >
>> > Maybe you could add code that saves the file (or just prompts the user
>> > to
>> > save
>> > the file) as soon as you create the file???
>> >
>> > Then you can use any name you or the user wants.
>> >
>> > John Brock wrote:
>> >>
>> >> Here is one problem: Let's say I pick a nice new temporary name
>> >> for my template file, say, "BudgetReport.xls". When I create the
>> >> file the user will see it as "BudgetReport1", and when he saves it
>> >> the suggested name will be "BudgetReport1.xls". The user gets to
>> >> modify the name, so maybe he gets rid of that pointless "1". No
>> >> problem so far, but what if he runs the program again? This time
>> >> I can't rename my template file, because that nice new name is
>> >> already taken! I could code around that, and temporarily rename
>> >> both files, but frankly it's not a big enough problem to be worth
>> >> the bother.
>> >>
>> >> Still, I think it's surprising that Microsoft doesn't allow the
>> >> programmer to control such a visible piece of text. The obvious
>> >> solution would be an optional parameter to the Add method, i.e.:
>> >>
>> >> Workbooks.Add("C:\temp\MyTemplateFile.xls", Name:="BudgetReport")
>> >>
>> >> I don't see any way this could cause any problems -- any Microsofties
>> >> out there listening?
>> >>
>> >> In article ,
>> >> Dave Peterson wrote:
>> >> >Maybe you could rename the template file to something more
>> >> >significant
>> >> >before
>> >> >you use it as the basis of your new workbook.
>> >> >
>> >> >Then rename it back (or just leave it with the new nice name).
>> >>
>> >> >John Brock wrote:
>> >> >>
>> >> >> 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.XlWBATemplate.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
>> >> jbrock@panix.com
>> >
>> > --
>> >
>> > Dave Peterson
>
> --
>
> Dave Peterson
|
|
| Back to top |
|
 |
|
|
| Related Topics: | replace Excel 2000 -> Excel 2003 I am using the following code to edit data cell by cell: What:="", I get a Microsoft error "Microsoft Excel cannot find any data to replace. Check if your search formatting and criteria are defined correctly. I
Excel chart from VB to Excel Hi I've a Chart object in a VB6 form together with some text boxes, my question is can I "copy" the chart object from the form and place it in a Excel chart ?? I know I can create the chart in a Excel my question is can I
Excel and OLE Is there any way to take an Excel object, whether it be a chart object or range, and connect it to an OLE control to show the object? For instance, if I had: Dim objApp As Dim objBooks As Dim range As Excel.range Dim objS
Excel I am a bit of an expert at programming, but a beginner at VB. I have VB6.0 and I cannot seem to figure out just how to get information from Excel. I just want to write a simple program that can read Excel documents and write them out as text files. We
OLE Control with Excel I'm using an OLE Control to display an Excel Workbook in my VB6 application. When I Embed the Workbook, it appears in a minimized state. For a view of the Workbook that fills the entire OLE Control, the marquise needs to be dragged manually with the mou |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|