• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

File not found Run time error 53

ThrottleWorks

Excel Ninja
Hi,

My friend is getting a bug while running below mentioned (part of) code on her system.

"File not found" Run time error 53. I tried de-bugging but could not succeed.

My guess is " fso.GetFile(sFile).OpenAsTextStream(1, -2)" this line is trying to open file which is not present at the path.

I tried to get values of different parameters using Ctrl G option but was unable to do so.

Sorry for so little details and asking for help but can anyone please help me what would be the bug cause.



Code:
Public Function GetDataFromfile(ByVal sFile As String) As String
    Dim fso As Object
    Dim TS As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
   
'Getting but at below mentioned line
 
    Set TS = fso.GetFile(sFile).OpenAsTextStream(1, -2)
    GetDataFromfile = TS.ReadAll
    TS.Close
End Function
 
@chirayu ! exactly, even I was searching where it is defined. I thought I am making some mistake.

I tried finding sFile in the module, not in the project, I will go back and check it.

If I am not wrong, sFile should have defined somewhere, right ?

Thanks for the help, good night. :).

PS - I think you are from Pune, right ? :)
 
Last edited:
I think sFile is supposed to be the filepath & filename. If it hasn't been defined then I guess the macro wouldn't find anything.

I'm in UK.
 
Back
Top