File Could not be Found

  • Thread starter Thread starter Vishal
  • Start date Start date
V

Vishal

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
 
Hi Vishal,

Try:

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

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

End Sub
'<<=============
 
Back
Top