Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error: Method 'OpenTextFile' of object 'IFileSystem' 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error: Method 'OpenTextFile' of object 'IFileSystem' failed
check if your problematic user can open the file from their computer.
Maybe they don't have permissions to that file. -- Regards, Tom Ogilvy "Learner" wrote in message oups.com... 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..... |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error: Method 'OpenTextFile' of object 'IFileSystem' failed
Tom,
yes, that user can manually open the file smoothly.... checked and also found that he has the latest version of scrrun.dll |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error: Method 'OpenTextFile' of object 'IFileSystem' failed
I would just use the built in FileIO to process the file and see if that
works. http://www.applecore99.com/gen/gen029.asp An example: Sub ReadStraightTextFile() Dim sStr as String Dim LineofText As String Dim rw as Long rw = 0 Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1 sStr = "" Do While Not EOF(1) Line Input #1, LineofText sStr = sStr & lineofText if len(sStr) = 178 then rw = rw + 1 cells(rw,1).Value = sStr sStr = "" End if Loop 'Close the file if len(sStr) 0 then cells(rw,1).Value = sStr End if Close #1 End Sub -- Regards, Tom Ogilvy "Learner" wrote in message oups.com... Tom, yes, that user can manually open the file smoothly.... checked and also found that he has the latest version of scrrun.dll |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error: Method 'OpenTextFile' of object 'IFileSystem' failed
I tried this and the Builtin I/O gave a different error. This time it
is 52 : Bad File number or name I looked at MSN KB and it says the problem is because of some bad file names such as starting with a ", /, lessthan 4 characters in filename etc. (My txt file is simple and its like \\FullyQualifiedSharedServer\SharedFolder\Mydata.t xt ) I am mostly certain that this is because the txt file is in the share and this user may not have default access to it (Meaning, when he manually double clicks on the txt file in question, he is getting a prompt to supply user id and password). So my question is, what is the workaround on it ? IOW, is it possible to supply UserId/Password as part of the OPEN statement ?.. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Error: Method OpenTextFile of IFilesystem3 failed | Excel Programming | |||
VBA Error: Method OpenTextFile of IFilesystem3 failed | Excel Programming | |||
VBA Error: Method OpenTextFile of IFilesystem3 failed | Excel Programming | |||
HELP on this strange errror : Method OpenTextFile of IFilesystem3 Failed | Excel Programming | |||
<Method 'Range' of object '_Global' failed error | Excel Programming |