|
-
May 15th, 2000, 06:22 AM
#1
Thread Starter
Hyperactive Member
FileSystemObject - Aaaaargh!!! Runtime error '70'
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]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|