Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default Open One Spreadsheet from Another

If I run the following macro code (VBA) from a folder on my internal C: hard
drive, it runs correctly (the running Excel spreadsheet with the macro finds
and opens the 2nd Excel spreadsheet).

ChDir (ActiveWorkbook.Path)
Workbooks.Open Filename:=File.xls

However, if co-locate the 2 spreadsheets on a thumb drive, the 1st one runs,
but when it tries to open the 2nd one, I get the message, 'it can't find the
second spreadsheet.' I've checked the Path in Debug and it is correct.
I've also tested this on an external hard drive with the same result. Both
the thumb drive and the external hard drive connect through a USB2 port.
Finally, I made the same test with the 2 spreadsheets co-located in my D:
partition on my internal hard drive with the same result.

I guess my question is, "is this normal behavior, one Excel spreadsheet
can't find and open another Excel spreadsheet unless the 2 of them are
located on the same drive as the Excel application?"

FYI, I'm running an older version of Excel (2003) and my OS is Vista Home
Premium.

Respectfully submitted,
Bob Myers

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Open One Spreadsheet from Another

ChDir doesn't change the drive--it just changes the current/logged directory on
that drive:

ChDrive activeworkbook.path
ChDir ActiveWorkbook.Path

'and this line isn't right as written. Maybe missing the double quotes???
Workbooks.Open Filename:="File.xls"

Or maybe better is to not change drive or folders:

workbooks.open filename:=activeworkbook.path & "\" & "file.xls"
or
workbooks.open filename:=activeworkbook.path & "\file.xls"



Bob Myers wrote:

If I run the following macro code (VBA) from a folder on my internal C: hard
drive, it runs correctly (the running Excel spreadsheet with the macro finds
and opens the 2nd Excel spreadsheet).

ChDir (ActiveWorkbook.Path)
Workbooks.Open Filename:=File.xls

However, if co-locate the 2 spreadsheets on a thumb drive, the 1st one runs,
but when it tries to open the 2nd one, I get the message, 'it can't find the
second spreadsheet.' I've checked the Path in Debug and it is correct.
I've also tested this on an external hard drive with the same result. Both
the thumb drive and the external hard drive connect through a USB2 port.
Finally, I made the same test with the 2 spreadsheets co-located in my D:
partition on my internal hard drive with the same result.

I guess my question is, "is this normal behavior, one Excel spreadsheet
can't find and open another Excel spreadsheet unless the 2 of them are
located on the same drive as the Excel application?"

FYI, I'm running an older version of Excel (2003) and my OS is Vista Home
Premium.

Respectfully submitted,
Bob Myers


--

Dave Peterson
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
Spreadsheet will not open without Excel Application being open fir Deirdre Lysaght Excel Discussion (Misc queries) 1 November 13th 07 05:11 PM
Help! I can't get a spreadsheet to open [email protected] New Users to Excel 1 August 20th 06 10:02 PM
2 spreadsheet with same name open PE Excel Discussion (Misc queries) 1 August 14th 06 08:41 PM
OPen one Spreadsheet from another Nigel Excel Discussion (Misc queries) 1 June 9th 06 10:34 PM
.xls spreadsheet will not open David Excel Discussion (Misc queries) 1 August 17th 05 12:01 AM


All times are GMT +1. The time now is 03:06 AM.

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"