View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_12_] Stuart[_12_] is offline
external usenet poster
 
Posts: 6
Default writing to txt files

I am wanting to write to the end of an existing text file. the following
works however I am sure their is a better way. i.e. not having to open it
twice!!


Open "C:\tempfolder\temp.txt" For Input As #1
iData = ""
Do While Not EOF(1)
Line Input #1, textLine
iData = iData & textLine
Loop
Close #1

Open "C:\tempfolder\temp.txt" For Output As #1
Print #1, iData & Chr(10) & iHist
Close #1