In this code I get subscript out of range for line 10 can anyone see my mistake?
Code:
Const ForReading = 1
Const ForWriting = 2
Const TristateFalse = 0
Dim line1
Dim line3
Dim line5
Set theArgs = WScript.Arguments
file1=theArgs(0)
Set fs = CreateObject("Scripting.FileSystemObject")
' open file to read from
Set f = fs.GetFile ("c:\255\quiz1.txt")
Set ts = f.OpenAsTextStream (ForReading, TristateFalse)
line1= ts.Readline
ts.skipline
line3= ts.Readline
ts.skipline
line5= ts.Readline
writetext
Sub writetext
Set fs = CreateObject("Scripting.FileSystemObject")
' open file to write to, create if not there, using ASCII
afile ="c:\255\" & file1
Set ts = fs.OpenTextFile(afile, ForWriting, True)
ts.WriteLine line1
ts.Writeline line3
ts.Writeline line5
ts.Close
End Sub