Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default File Could not be Found

Hi

I want to open a file using my Macro. But I dont want to give the
absolute path.
I've the macro in FileA.xls and I want to open FileB.xls and both the
files are in the same directory.

I am using Workbooks.open filename:= "FileB.xls"

But it gives me the error - File FileB.xls could not be found.
If I use the absolute path in the above statement, everything works
fine.

Any suggestions ?

Thanks
Vishal

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default File Could not be Found

Hi Vishal,

Try:

'=============
Public Sub Tester()
Dim sPath As String

sPath = ThisWorkbook.Path
Workbooks.Open Filename:=sPath & "\" & "FileB.xls"

End Sub
'<<=============

---
Regards,
Norman



"Vishal" wrote in message
oups.com...
Hi

I want to open a file using my Macro. But I dont want to give the
absolute path.
I've the macro in FileA.xls and I want to open FileB.xls and both the
files are in the same directory.

I am using Workbooks.open filename:= "FileB.xls"

But it gives me the error - File FileB.xls could not be found.
If I use the absolute path in the above statement, everything works
fine.

Any suggestions ?

Thanks
Vishal



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
File not found Eric Excel Discussion (Misc queries) 3 February 27th 08 08:40 PM
File not found Brettjg Excel Discussion (Misc queries) 2 December 2nd 07 09:46 PM
File Not Found menu pops up after I open a file Harveytunes Excel Discussion (Misc queries) 3 January 27th 06 07:23 PM
How do I reference external data from a file, file name found in . Clux Excel Discussion (Misc queries) 1 February 10th 05 10:52 PM
'File not found' Hank Scorpio Excel Programming 0 July 29th 03 10:45 AM


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