ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel Extensions (https://www.excelbanter.com/excel-discussion-misc-queries/162118-excel-extensions.html)

CH

Excel Extensions
 
Hi All,

I received a VBA which contains the sentences that goes like :
Set WH = workbook("file1").

file1 is an excel workbook and it is open.

It worked fine most of the time. However, one of my computers shows
"subscription out of range" when I tried to execute this VBA.

My colleague changed the statement to
Set WH = workbook("file1.xls") with the extension.

It now works fine on this computer but he does not understand how it works
with the extension.

How can we set Excel such that it disregards the extension?

Dave Peterson

Excel Extensions
 
Excel uses a windows setting
In winXP Home:
Open windows explorer
Tools|Folder Options|View tab
check "hide extensions for known file types"
(this is a user by user setting, too!)

But this will tick most users off--it would me! I always want to see the
extensions.

You'll be better off if you change the code to always include the extension.

I don't think you'll be able to control users to leave this setting the way you
want.



ch wrote:

Hi All,

I received a VBA which contains the sentences that goes like :
Set WH = workbook("file1").

file1 is an excel workbook and it is open.

It worked fine most of the time. However, one of my computers shows
"subscription out of range" when I tried to execute this VBA.

My colleague changed the statement to
Set WH = workbook("file1.xls") with the extension.

It now works fine on this computer but he does not understand how it works
with the extension.

How can we set Excel such that it disregards the extension?


--

Dave Peterson

John Bundy

Excel Extensions
 
As far as i know that cannot be done. Someone else here might be able to tell
me i'm wrong, but i believe if you have another type of file with the same
name it will generate the error. Why can you not use the extension?
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"ch" wrote:

Hi All,

I received a VBA which contains the sentences that goes like :
Set WH = workbook("file1").

file1 is an excel workbook and it is open.

It worked fine most of the time. However, one of my computers shows
"subscription out of range" when I tried to execute this VBA.

My colleague changed the statement to
Set WH = workbook("file1.xls") with the extension.

It now works fine on this computer but he does not understand how it works
with the extension.

How can we set Excel such that it disregards the extension?



All times are GMT +1. The time now is 11:50 PM.

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