Forum Discussion
dmiscannon
10 years agoFrequent Contributor
I tried your code and got an "Object Required" error.
The below code may help. I copied it from the IsEndOfFile Method page of TestComplete Help.
Sub ReadTextFromFile
Dim sPath
sPath = "D:\Files\MyFile.txt"
' Opens the specified file for reading
Set myFile = aqFile.OpenTextFile(sPath, aqFile.faRead, aqFile.ctUnicode) ' I think this line will help you. Notepad will not display, but the file will open in the background.
Log.Message("File by lines:")
' Reads text lines from the file and posts them to the test log
While Not myFile.IsEndOfFile()
s = myFile.ReadLine()
Log.Message(s)
WEnd
' Closes the file
Call myFile.Close()
End Sub
Related Content
- 2 years ago
- 3 years ago
- 2 years ago
Recent Discussions
- 3 hours ago