Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.dotnet.languages.vb,microsoft.public.vb.ole.automation,microsoft.public.vb.ole
external usenet poster
 
Posts: 10
Default 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
...
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
...
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.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


--

Dave Peterson


--

Dave Peterson



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
How can I have an initial zero in an Excel cell? ALupin Excel Discussion (Misc queries) 4 November 11th 06 10:16 AM
Excel NPV initial cost in value1 and first year return in value2? Johanna Excel Worksheet Functions 3 September 12th 06 11:12 PM
Format fonts (ie, initial cap) in Excel like you can in Word. gojackets1979 Excel Discussion (Misc queries) 1 October 14th 05 12:20 AM
Remove middle initial from "first name middle initial" Justin F. Excel Discussion (Misc queries) 15 September 26th 05 06:13 PM
How do you calculate CAGR In Excel 2003 with no initial cost? Boney Excel Worksheet Functions 1 September 15th 05 09:39 PM


All times are GMT +1. The time now is 09:38 PM.

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

About Us

"It's about Microsoft Excel"