I'm doing a VBscript. I have had some success so far, with populating recordsets and moving files.
The next thing I need to do is read a textfiile. The code I am using seems to be a textbook example but I can't get it to work.
Set fso = CreateObject("Scripting.FileSystemObject")
Set stream = fs
penTextFile(pathToTextFile, 1) '1 means ForReading
Dim Ln
Do Until stream.AtEndOfStream
Ln = stream.ReadLine
Loop
I purchased a VBscript editor which has a debugger. When I step through the code, I verified that "PathToTextFile" has the correct value and I verified that this textfile does indeed contain a lot of text.
The code isn't throwing any errors. However, the variable "Ln" remains an empty string. It's not reading the text. It's just a regular plain text file editable in Wordpad or Notepad.
The next thing I need to do is read a textfiile. The code I am using seems to be a textbook example but I can't get it to work.
Set fso = CreateObject("Scripting.FileSystemObject")
Set stream = fs

Dim Ln
Do Until stream.AtEndOfStream
Ln = stream.ReadLine
Loop
I purchased a VBscript editor which has a debugger. When I step through the code, I verified that "PathToTextFile" has the correct value and I verified that this textfile does indeed contain a lot of text.
The code isn't throwing any errors. However, the variable "Ln" remains an empty string. It's not reading the text. It's just a regular plain text file editable in Wordpad or Notepad.