Rewrite the text file


[VBA]Sub test()
Dim FS, A
Dim MyPath As String, MyFile As String, fil As String, X As String

MyPath = "C:\AAA\"
MyFile = "New.txt"

fil = MyPath & MyFile

Set FS = CreateObject("Scripting.FileSystemObject")
Set A = FS.OpenTextFile(fil, 1)
X = A.ReadAll
A.Close
Kill fil

Set A = FS.CreateTextFile(fil)
A.WriteLine ("This is a test.")
A.Write (X)
A.Close


End Sub
[/VBA]