LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Trying to append to file using an array

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append text file Jeff Excel Discussion (Misc queries) 6 October 8th 07 05:56 PM
Append data from a column to separate table array miss_q Excel Programming 5 December 12th 05 11:01 PM
append file on e-mail Sylvian[_9_] Excel Programming 0 September 7th 05 07:57 PM
append file on e-mail Sylvian Excel Discussion (Misc queries) 0 September 7th 05 07:23 PM
File Append Row by Cell value Djmask[_8_] Excel Programming 3 August 22nd 05 04:37 AM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"