Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default VBA Error: Method OpenTextFile of IFilesystem3 failed

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.....

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default VBA Error: Method OpenTextFile of IFilesystem3 failed

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...

"Learner" wrote:

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.....


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: method 'select' of object_worksheet' failed Carl Excel Discussion (Misc queries) 4 September 9th 06 08:52 PM
HELP on this strange errror : Method OpenTextFile of IFilesystem3 Failed Learner[_3_] Excel Programming 3 February 22nd 05 02:36 PM
Run-time error : method failed Joris Adriaenssens Excel Programming 4 June 11th 04 05:07 PM
Paste method of worksheet class failed error Todd Huttenstine[_2_] Excel Programming 1 December 16th 03 10:08 AM
HELP!!!! -- (Method Range of _Worksheet failed) ERROR! Fusion[_2_] Excel Programming 4 November 24th 03 03:32 PM


All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"