Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File not found | Excel Discussion (Misc queries) | |||
File not found | Excel Discussion (Misc queries) | |||
File Not Found menu pops up after I open a file | Excel Discussion (Misc queries) | |||
How do I reference external data from a file, file name found in . | Excel Discussion (Misc queries) | |||
'File not found' | Excel Programming |