Here is code to create blank text file (just comment out the lines for adding text, and add the MS Scripting Runtime library to your VBA references)
From here:
http://www.ozgrid.com/forum/showthread.php?t=58283&page=1Sub WriteTextFile()
' Writing a text file using File System Object in VBA
' This code requires a reference (In the VBE Tools > References) to Microsoft Scripting Runtime
Dim FSO As FileSystemObject
Dim FSOFile As TextStream
Dim FilePath As String
Dim NoOfLoop As Integer
FilePath = "c:\WriteTest.txt" ' create a test.txt file or change this
Set FSO = New FileSystemObject
' opens file in write mode
Set FSOFile = FSO.OpenTextFile(FilePath,
2, True)
' 'loop round adding lines
' For NoOfLoop = 1 To 10
' ' write your code here
' FSOFile.WriteLine (" I am writing line " & NoOfLoop)
' Next NoOfLoop
FSOFile.Close
End Sub
Again, armed with all of this knowledge, I am sure you can make your system work as specified.
;-)
JeffCoachman