vqthomf said:
Hi can anyone help I am trying to select all records from a text file ane
append the text into another text file.
Call WriteFile("f1.txt", ReadFile("f1.txt") & ReadFile("f2.txt"))
Public Function ReadFile(ByVal FileName As String) As String
Dim hFile As Long
On Error GoTo Hell
hFile = FreeFile
Open FileName For Binary As #hFile
ReadFile = Space$(LOF(hFile))
Get #hFile, , ReadFile
Close #hFile
Hell:
End Function
Public Function WriteFile(ByVal FileName As String, ByVal Text As String) As
Boolean
Dim hFile As Long
On Error GoTo Hell
hFile = FreeFile
Open FileName For Output As #hFile
Print #hFile, Text
Close #hFile
Hell:
WriteFile = Not CBool(Err.Number)
End Function
If your files are humongous (in the >100Mb range), more optimal solutions are
available.