kdjonesmtb2
Technical User
This code to append a text file gets a type mismatch error
What is correct method to write out "arr" to the txt file
Type mismatch: 'qfile1.Write'
Line (4064): "qfile1.Write(arr)".
Dim arr
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest" & cstr(row)& ".x12", ForReading,True)
'Skip through the first two lines
f.readline
f.readline
'Read till the end of file, if the line is not "end", split it based on ","
while not f.AtEndOfStream
line = f.readline()
if line <> "end" then
arr = split(line, ",")
'Write the arr to file
Set fso=createobject("Scripting.FileSystemObject")
Set qfile1 = fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest_full..x12", ForAppending,True)
qfile1.Write(arr)
end if
wend
What is correct method to write out "arr" to the txt file
Type mismatch: 'qfile1.Write'
Line (4064): "qfile1.Write(arr)".
Dim arr
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest" & cstr(row)& ".x12", ForReading,True)
'Skip through the first two lines
f.readline
f.readline
'Read till the end of file, if the line is not "end", split it based on ","
while not f.AtEndOfStream
line = f.readline()
if line <> "end" then
arr = split(line, ",")
'Write the arr to file
Set fso=createobject("Scripting.FileSystemObject")
Set qfile1 = fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest_full..x12", ForAppending,True)
qfile1.Write(arr)
end if
wend