LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Referring to a member of the workbooks collection by name.

Hi

Writing code recently that selected a workbook by name, I hit a
problem. The code looked like this:

Workbooks("MyFile.xls").worksheets("Sheet1").Range ("A2").Value="Fred"

This worked fine on my machine, but not on a second one, returning
(from memory) a "Subscript out of range" error. However, on the second
machine it worked fine when I removed the .xls portion of the file
name.

I could get the other machine to accept the same code as mine, by
choosing its option in My Computer not to hide file extensions for
known file types, or get my machine to work like the second one by
choosing to hide the extensions.

My question, then, is this. How do you write code which will work no
matter what the user has set under their folder view options? Surely I
don't need to be making a call to the API to detect such settings?

Thanks
Andrew

 
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
PivotTable with Member Property - how to subtotal on Member Proper swordsman Excel Programming 0 June 23rd 06 10:01 PM
Workbooks collection is empty even though the some of the document is open [email protected] Excel Programming 12 December 28th 05 10:47 AM
Referring to other workbooks jkitzy Excel Programming 1 January 7th 05 02:42 AM
Problems with referring to workbooks Matt Lawson Excel Programming 1 February 21st 04 04:26 PM
Is it possible to set a class member to be another class member? Michael[_21_] Excel Programming 3 October 30th 03 08:28 AM


All times are GMT +1. The time now is 09:19 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"