View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
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