Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript to append txt file gets a type mismatch error

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
0
0
US
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 = fso_OpenTextFile("\\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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top