VBA Error: Method OpenTextFile of IFilesystem3 failed

  • Thread starter Thread starter Learner
  • Start date Start date
L

Learner

I have a VBA macro on MS Excel that should open and read from a Text
file. This is the code


Dim fs, Tempfile
Set fs = CreateObject("Scripting.FileSystemObject")
Set TempFile = fs.OpenTextFile(strInputFile, 1, False)
Do While TempFile.AtEndOfLine <> True
' Process
Loop

I found that it throws error in the OpenTextFile mothod above..

It works for all of our users but one. One guy is getting this strange
error meesage when the code executes. I checked his MS excel and found
its same as mine, Office 2003 SP1 (The code works fine in my machine).


Can you GURUS please help me on this.....
 
So it is not specifically a code problem but rater it is either a settings
problem or an access problem. Does this person who gets the error have access
to the file in question? If so do they have writes to open the file? Finally
do they use the same drive mapping as everyone else to get to the file (this
assumes a locally mapped network drive. For you the file is on the X drive.
For him the file is on the Y drive.)?

Tha tis where I would start...
 
Back
Top