open text file - read line from text file
Posted on 2001-06-17
By using this simple code I am able to write a line to a text file.
Dim fs, otf
Set fs = CreateObject("Scripting.FileSystemObject")
Set otf = fs.OpenTextFile("c:\test.txt", 8, 0)
However, in examples that I see in MSDN and elsewhere, objects are inititalized by using the following
Dim fso As New FileSystemObject, txtfile, _
fil1 As File, ts As TextStream
However I get the error message "user defined type not defined." How come its not defined? What am I doing wrong. With the inelli type for diming variables I will see dim x as "integer" but I do not see FileSystemObject, File, or TextStream.
Please show me how to initialize properly so I can at least read on line from a text file.