Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook and Window object question

Hi all,

I have a question about specifying a member of the workbooks and windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that whether I
should specify it as Workbooks("abcde.xls") or just Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file types".
That makes a problem for me as my macros will be run on someone else's
computers.

Are there any possible means to make things easier, for example is it
possible to use wildcards to specify a member of a workbooks or windows
collection? Please advise.

Frederick Chow
Hong Kong.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Workbook and Window object question

Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it will work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that whether I
should specify it as Workbooks("abcde.xls") or just Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on someone
else's computers.

Are there any possible means to make things easier, for example is it
possible to use wildcards to specify a member of a workbooks or windows
collection? Please advise.

Frederick Chow
Hong Kong.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook and Window object question

I know, but I can't be sure if my macro will work properly if someone else's
PC doesn't use extensions. So any further advise?

Frederick Chow

"Doug Glancy" wrote in message
...
Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it will work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that whether I
should specify it as Workbooks("abcde.xls") or just Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on someone
else's computers.

Are there any possible means to make things easier, for example is it
possible to use wildcards to specify a member of a workbooks or windows
collection? Please advise.

Frederick Chow
Hong Kong.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Workbook and Window object question

All PC's support extensions. the option you talk about just doesn't display
the extension. It doesn't change the way Excel saves the file.

If you are querying the user for the filename (and you thing they may not
enter the extension), then you can check for the existence of the file with
the Dir command. the dir command does support wildcards. Once you
ascertain the existence of the file and its exact name, you can proceed.
Use the exact name of the file (including extension if it has one) and you
should do fine.

--
Regards,
Tom Ogilvy

"Frederick Chow" wrote in message
...
I know, but I can't be sure if my macro will work properly if someone

else's
PC doesn't use extensions. So any further advise?

Frederick Chow

"Doug Glancy" wrote in message
...
Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it will

work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and

windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that whether I
should specify it as Workbooks("abcde.xls") or just Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on someone
else's computers.

Are there any possible means to make things easier, for example is it
possible to use wildcards to specify a member of a workbooks or windows
collection? Please advise.

Frederick Chow
Hong Kong.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook and Window object question

Oh, I didn't mean that.

Try it:

1. Suppose you have a workbook called "ABCDE.xls".
2. Make sure that the folder setting "Hide extensions for known file types"
is turned OFF
3. In immediate window type "workbooks("ABCDE.xls").name" - no error
4. Turn ON the folder setting "Hide extensions for know file types".
5. Re-run the same command "workbooks("ABCDE.xls").name - ERROR
6. Run a similar command "workbooks("ABCDE").name - OK

Frederick Chow

"Tom Ogilvy" wrote in message
...
All PC's support extensions. the option you talk about just doesn't
display
the extension. It doesn't change the way Excel saves the file.

If you are querying the user for the filename (and you thing they may not
enter the extension), then you can check for the existence of the file
with
the Dir command. the dir command does support wildcards. Once you
ascertain the existence of the file and its exact name, you can proceed.
Use the exact name of the file (including extension if it has one) and you
should do fine.

--
Regards,
Tom Ogilvy

"Frederick Chow" wrote in message
...
I know, but I can't be sure if my macro will work properly if someone

else's
PC doesn't use extensions. So any further advise?

Frederick Chow

"Doug Glancy" wrote in message
...
Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it will

work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and

windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that whether
I
should specify it as Workbooks("abcde.xls") or just Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on
someone
else's computers.

Are there any possible means to make things easier, for example is it
possible to use wildcards to specify a member of a workbooks or
windows
collection? Please advise.

Frederick Chow
Hong Kong.











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Workbook and Window object question

I can't reproduce that error. It always works if you use the full name.

without "Hide extensions for known file types" (not selected)

? workbooks("abcdef").name '<== error
? workbooks("abcdef.xls").Name
abcdef.xls

With Hide extensions for known file types" (selected)
? workbooks("abcdef").name
abcdef.xls
? workbooks("abcdef.xls").Name
abcdef.xls

You already agreed that you know that:

Glancy:
If you use the file extension, e.g., Workbooks(''tester.xls") it will work
for either Windows setting.

Your Response
I know, . . .


So now two people have told you. If your getting a different result, it may
be a regional issue.

--
Regards,
Tom Ogilvy


"Frederick Chow" wrote in message
...
Oh, I didn't mean that.

Try it:

1. Suppose you have a workbook called "ABCDE.xls".
2. Make sure that the folder setting "Hide extensions for known file

types"
is turned OFF
3. In immediate window type "workbooks("ABCDE.xls").name" - no error
4. Turn ON the folder setting "Hide extensions for know file types".
5. Re-run the same command "workbooks("ABCDE.xls").name - ERROR
6. Run a similar command "workbooks("ABCDE").name - OK

Frederick Chow

"Tom Ogilvy" wrote in message
...
All PC's support extensions. the option you talk about just doesn't
display
the extension. It doesn't change the way Excel saves the file.

If you are querying the user for the filename (and you thing they may

not
enter the extension), then you can check for the existence of the file
with
the Dir command. the dir command does support wildcards. Once you
ascertain the existence of the file and its exact name, you can proceed.
Use the exact name of the file (including extension if it has one) and

you
should do fine.

--
Regards,
Tom Ogilvy

"Frederick Chow" wrote in message
...
I know, but I can't be sure if my macro will work properly if someone

else's
PC doesn't use extensions. So any further advise?

Frederick Chow

"Doug Glancy" wrote in message
...
Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it will

work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and

windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that

whether
I
should specify it as Workbooks("abcde.xls") or just

Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on
someone
else's computers.

Are there any possible means to make things easier, for example is

it
possible to use wildcards to specify a member of a workbooks or
windows
collection? Please advise.

Frederick Chow
Hong Kong.











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook and Window object question

Tom,

Thank you very much anyway for your effort.

Frederick Chow

"Tom Ogilvy" wrote in message
...
I can't reproduce that error. It always works if you use the full name.

without "Hide extensions for known file types" (not selected)

? workbooks("abcdef").name '<== error
? workbooks("abcdef.xls").Name
abcdef.xls

With Hide extensions for known file types" (selected)
? workbooks("abcdef").name
abcdef.xls
? workbooks("abcdef.xls").Name
abcdef.xls

You already agreed that you know that:

Glancy:
If you use the file extension, e.g., Workbooks(''tester.xls") it will
work
for either Windows setting.

Your Response
I know, . . .


So now two people have told you. If your getting a different result, it
may
be a regional issue.

--
Regards,
Tom Ogilvy


"Frederick Chow" wrote in message
...
Oh, I didn't mean that.

Try it:

1. Suppose you have a workbook called "ABCDE.xls".
2. Make sure that the folder setting "Hide extensions for known file

types"
is turned OFF
3. In immediate window type "workbooks("ABCDE.xls").name" - no error
4. Turn ON the folder setting "Hide extensions for know file types".
5. Re-run the same command "workbooks("ABCDE.xls").name - ERROR
6. Run a similar command "workbooks("ABCDE").name - OK

Frederick Chow

"Tom Ogilvy" wrote in message
...
All PC's support extensions. the option you talk about just doesn't
display
the extension. It doesn't change the way Excel saves the file.

If you are querying the user for the filename (and you thing they may

not
enter the extension), then you can check for the existence of the file
with
the Dir command. the dir command does support wildcards. Once you
ascertain the existence of the file and its exact name, you can
proceed.
Use the exact name of the file (including extension if it has one) and

you
should do fine.

--
Regards,
Tom Ogilvy

"Frederick Chow" wrote in message
...
I know, but I can't be sure if my macro will work properly if someone
else's
PC doesn't use extensions. So any further advise?

Frederick Chow

"Doug Glancy" wrote in message
...
Frederick,

If you use the file extension, e.g., Workbooks(''tester.xls") it
will
work
for either Windows setting.

hth,

Doug


"Frederick Chow" wrote in message
...
Hi all,

I have a question about specifying a member of the workbooks and
windows
collection.

Suppose I have opened a file called "ABCDE.XLS", I found that

whether
I
should specify it as Workbooks("abcde.xls") or just

Workbooks("abcde")
depends on a windows folder setting "Hide extensions for known file
types". That makes a problem for me as my macros will be run on
someone
else's computers.

Are there any possible means to make things easier, for example is

it
possible to use wildcards to specify a member of a workbooks or
windows
collection? Please advise.

Frederick Chow
Hong Kong.













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 to understand the Window Object? clara Excel Discussion (Misc queries) 3 April 10th 07 07:20 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM
How to assign an object to a child IE window Jason Excel Programming 2 March 2nd 05 03:55 AM
OpenText Method of Workbook Object Question John Excel Programming 2 October 20th 04 07:39 PM
Where to get a visual tree-like object like the one used in the watch-window? Jurry[_10_] Excel Programming 2 May 5th 04 06:05 PM


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

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

About Us

"It's about Microsoft Excel"