[AccessD] New excel workbooks

John Colby jwcolby at ColbyConsulting.com
Sat Jan 21 13:01:17 CST 2006


Gustav,

Actually, after testing I have determined that workbooks are stored using
the file name minus the path.  Thus X:\test.XLS would create a workbook that
you could access using app.workbooks("test.xls").  This is a little
inconvenient since it means that if I need to access a workbook in the
collection by name, I need to have code that strips out the filename, so I
can feed that in.  Nothing beyond my ability or anything, just extra work to
handle it.

The consumer of my class always knows the FILESPEC of the workbook (because
the filespec is passed in to open it originally), but may not know the
FILENAME of the workbook, thus it would be convenient to allow the user to
apss in the FILESPEC and get at a workbook that way.  In fact my class needs
to handle either the filename or the filespec passed in to the parameter
when requesting a workbook.

This is when the .NET ability to create signatures is handy.

John W. Colby
www.ColbyConsulting.com 


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Saturday, January 21, 2006 12:10 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] New excel workbooks

Hi John

  Workbooks.Add 

A new workbook gets the id equal to the count of workbooks.

  lngWorkbooks = Workbooks.Count
  strWorkbookNewName = Workbooks.Item(lngWorkbooks).Name

That's a default localized name like "Book2" etc. until you save it.

/gustav

>>> jwcolby at ColbyConsulting.com 21-01-2006 17:44:14 >>>
Are workbooks "named" when they are saved in the Workbooks() collection, and
if so does it use the filespec as the name?  If not, how do you specify
switching to a specific new workbook if there are several workbooks in the
workbook collection?

John W. Colby
www.ColbyConsulting.com 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list