S
Susan Hayes
Hi
Im trying to append the info in an array which has numbers and letters. I cannot get the array to write to it.
This does work because Ive tried the appending "hello World" to it. It also appends the ","
Any help is appreciated
Thanks
And Thanks again for the many helps this group has provided to me
Mike
Dim myarray(19) as Variant
Dim fs, f, ts, s, chk
Set fs = CreateObject("Scripting.FileSystemObject")
chk = fs.FileExists("c:\data.txt")
If chk = True Then ' check if file exists
Set f = fs.GetFile("c:\data.txt")
Set ts = f.OpenAsTextStream(8, 0)
ts.write "Hello World"
For i = 1 To 19
ts.write myarray(i) & ","
Next
ts.write vbCrLf
ts.Close
Else 'if not create file
fs.CreateTextFile "c:\data.txt" 'creates file
Set f = fs.GetFile("c:\data.txt")
Set ts = f.OpenAsTextStream(8, 0)
ts.write "Hello World"
For i = 1 To 19
ts.write myarray(i) & ","
Next
ts.write vbCrLf
ts.Close
End If
Im trying to append the info in an array which has numbers and letters. I cannot get the array to write to it.
This does work because Ive tried the appending "hello World" to it. It also appends the ","
Any help is appreciated
Thanks
And Thanks again for the many helps this group has provided to me
Mike
Dim myarray(19) as Variant
Dim fs, f, ts, s, chk
Set fs = CreateObject("Scripting.FileSystemObject")
chk = fs.FileExists("c:\data.txt")
If chk = True Then ' check if file exists
Set f = fs.GetFile("c:\data.txt")
Set ts = f.OpenAsTextStream(8, 0)
ts.write "Hello World"
For i = 1 To 19
ts.write myarray(i) & ","
Next
ts.write vbCrLf
ts.Close
Else 'if not create file
fs.CreateTextFile "c:\data.txt" 'creates file
Set f = fs.GetFile("c:\data.txt")
Set ts = f.OpenAsTextStream(8, 0)
ts.write "Hello World"
For i = 1 To 19
ts.write myarray(i) & ","
Next
ts.write vbCrLf
ts.Close
End If