Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileHandling
#1
Solved: 10 Years, 9 Months ago
Hi
I am a QTP beginner.
I wrote some code for file handling and I receive the error message saying "Invalid procedure call or argument" at line 8.
The code is below:
Code:
Dim fso1,file1,file1location
file1location = "c:\textfile.txt"
Set fso1 = createobject("scripting.filesystemobject")
Set file1 = fso1.createtextfile(file1location,true)
file1.write("This is Usha")
file1.write("Rani")
file1.close()
'The error is coming at the following line
Set file1 = fso1.opentextfile("c:\textfile.txt", ForReading, True)
Do while file1.AtEndOfStream<>true
    msgbox file1.readline()
Loop
Can anybody please help me?
Thank you
Reply
#2
Solved: 10 Years, 9 Months ago
Instead of ....
Code:
Set file1 = fso1.opentextfile("c:\textfile.txt", ForReading, True)

Try this.......
Code:
Set file1 = fso1.opentextfile("c:\textfile.txt",1, True)
Reply
#3
Solved: 10 Years, 9 Months ago
Hey
It worked.
Thank you so much for the reply.
Do you have any idea why it didn't take "For reading" argument..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)