Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Open Workbooks present in the same directory

Hi,

I am creating a macro that will use data that resides in the same
directory as the file that has the macro code.

My Macro runs like this:

Workbooks.Open "Slash Daily Case Closed.xls"

When I open the file (reports.xls) from explorer and run the macro it
gives me error 1004.

However, when i use File Open and open reports.xls, the macro runs
perfectly fine.

Any help would be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Open Workbooks present in the same directory

On Apr 30, 12:51 pm, wrote:
Hi,

I am creating a macro that will use data that resides in the same
directory as the file that has the macro code.

My Macro runs like this:

Workbooks.Open "Slash Daily Case Closed.xls"

When I open the file (reports.xls) from explorer and run the macro it
gives me error 1004.

However, when i use File Open and open reports.xls, the macro runs
perfectly fine.

Any help would be greatly appreciated.


You need to give the full path... Workbooks.Open "C:\Documents and
Settings\Admin\Desktop\reports.xls" and it'll work both ways...

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Open Workbooks present in the same directory

I wont be able to give full path because I am creating a report that
multiple people will be running and using this macro... is there an
alternate method ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Open Workbooks present in the same directory

On Apr 30, 11:14 pm, wrote:
I wont be able to give full path because I am creating a report that
multiple people will be running and using this macro... is there an
alternate method ?



From the following website:

http://www.excel-vba.com/vba-12-code-workbooks.htm
******************start quote************

Opening Workbooks

To open another Excel file (workbook) with a VBA procedure you simply
write (notice that "Workbooks" is plural):
Workbooks.Open "suchAndSuch.xls"
You don't need to specify a directory (path) if the second workbook
resides in the same directory as "ThisWorkbook"

******************end quote************

So, when I open a file from a folder, then I should be able to just
open other files in the same directory ?

Balajii

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
listing all sheets in all workbooks in a directory Todd Huttenstine Excel Programming 3 March 2nd 06 03:29 PM
open in old directory save in new directory tim64[_2_] Excel Programming 0 June 15th 05 07:48 PM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
summary of multiple workbooks in a directory William Hamilton[_2_] Excel Programming 0 May 10th 04 12:42 AM
Count of workbooks in a directory David Excel Programming 1 November 11th 03 10:20 PM


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