View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
lif[_13_] lif[_13_] is offline
external usenet poster
 
Posts: 1
Default appending line to text file


Hi Leith,

Here's a belated thanks! I solved it in a very similar way. Here's my
code for posterity

Dim FinalFile As Integer
Dim PreFile As Integer
Dim PreName(1 To 25) As String
Dim FinalName(1 To 25) As String
Dim fso As Object
Dim Temp As String


FinalName(numberofwafermaps) =
WafermapPath & ERsheetname(I) & ".txt"
PreName(numberofwafermaps) =
WafermapPath & ERsheetname(I) & "-pre.txt"
FinalFile = FreeFile()


Set fso =
CreateObject("Scripting.FileSystemObject")

If
(fso.FileExists(FinalName(numberofwafermaps))) Then
Kill
FinalName(numberofwafermaps)
End If

Close #FinalFile
Open FinalName(numberofwafermaps)
For Append As FinalFile
Print #FinalFile, "Mesh AutoCreate"


PreFile = FreeFile()

Open PreName(numberofwafermaps)
For Input As PreFile
'
Do While Not EOF(PreFile)
Line Input #PreFile, Temp
Print #FinalFile, Temp
Loop

'CloseFiles:
'
' ' Close the destination file and
the source file.
Close #PreFile
Close #FinalFile

If
(fso.FileExists(PreName(numberofwafermaps))) Then
Kill
PreName(numberofwafermaps)
End If


--
lif
------------------------------------------------------------------------
lif's Profile: http://www.excelforum.com/member.php...o&userid=35745
View this thread: http://www.excelforum.com/showthread...hreadid=563543