Microsoft Visual Basic 6.0 Programmers Guide page 740 contains an example which is giving me a runtime error. I have checked every line of code, and this error still exists. I have included the scrrun.dll and it still does it. Any ideas? Here is the code:

Public Sub Read_Files()
Dim fso As New fileSystemObject, txtfile, fil1 As File, ts As TextStream
Set txtfile = fso.CreateTextFile("c:\testfile.txt", True)
MsgBox "Writing file"
' Write a line.
Set fil1 = fso.Getfile("c:\testfile.txt")
Set ts = fil1.OpenAsTextStream(ForWriting)
ts.write "Hello World"
ts.Close
'read the contents of the file
Set ts = fil1.OpenAsTextStream(ForReading)
s = ts.readline
MsgBox s
ts.Close

End Sub

[Edited by Sal on 05-15-2000 at 07:24 PM]