View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Silencer116 Silencer116 is offline
external usenet poster
 
Posts: 8
Default Logging data using the same textfile over and over again

Hey all.

I am working on a log-like mechanism in VBA. I programmed the following
sub:

Sub CreateLog()

Datum = Date
Tijd = Time

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("H:\test " + Cstr(Datum) + ".txt", True)
a.WriteLine("The process begun @ " + Cstr(Tijd) + " on " + Cstr(Datum))

a.close

End Sub

But this overwrites the textfile over and over again. I would like it
to open the existing textfile, and add a new line (the same line as
above) on top of the other line(s)

The result would be a summary of lines in one textfile. Everytime this
macro is activated i would like to be an line added.

is this possible? if yes, please could anyone help me?