ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook Collection (https://www.excelbanter.com/excel-programming/325468-workbook-collection.html)

Paul Larick

Workbook Collection
 
Hello-

I wrote code that works with several open workbooks. I
specify particular workbooks using the Workbooks
collection and the name of the workbook, e.g., Workbooks
("Name"). There are a few machines, however, that require
the ".xls" extension, e.g., Workbooks("Name.xls"). Can I
do something, like reference a particular library, to make
sure that one of the methods is going to work? Thanks.

-Paul Larick

Bob Phillips[_6_]

Workbook Collection
 
Why not try both names, with error handling wrapped around it, to test
neither existing?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Paul Larick" wrote in message
...
Hello-

I wrote code that works with several open workbooks. I
specify particular workbooks using the Workbooks
collection and the name of the workbook, e.g., Workbooks
("Name"). There are a few machines, however, that require
the ".xls" extension, e.g., Workbooks("Name.xls"). Can I
do something, like reference a particular library, to make
sure that one of the methods is going to work? Thanks.

-Paul Larick




Chip Pearson

Workbook Collection
 
It is based on a Windows setting. Always use the .xls extension
to be safe. It will always work.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Paul Larick" wrote in message
...
Hello-

I wrote code that works with several open workbooks. I
specify particular workbooks using the Workbooks
collection and the name of the workbook, e.g., Workbooks
("Name"). There are a few machines, however, that require
the ".xls" extension, e.g., Workbooks("Name.xls"). Can I
do something, like reference a particular library, to make
sure that one of the methods is going to work? Thanks.

-Paul Larick




Harald Staff

Workbook Collection
 
Hi Paul

Like Bob, I think the easiest fastest way is to test both. But for the fun
of it, see if it has to do with "hide extensions for known file types" in
Explorer. That would be wether registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Explorer\Advance
d\HideFileExt
is 0 (false) or 1(true).

HTH. Best wishes Harald

"Paul Larick" skrev i melding
...
Hello-

I wrote code that works with several open workbooks. I
specify particular workbooks using the Workbooks
collection and the name of the workbook, e.g., Workbooks
("Name"). There are a few machines, however, that require
the ".xls" extension, e.g., Workbooks("Name.xls"). Can I
do something, like reference a particular library, to make
sure that one of the methods is going to work? Thanks.

-Paul Larick




Harald Staff

Workbook Collection
 
"Chip Pearson" skrev i melding
...
(..) Always use the .xls extension
to be safe. It will always work.


It's that simple ? Thanks Chip.
Best wishes Harald




All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com