No that was fine. Worked exactly as needed thank you very much
Mark
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:d9**********@localhost.localdomain...
Mark wrote:
Hi All,
I am trying to keep a log file of what is going on with my frontend. I
have achieved this with the following code:
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("K:\Systems\Backup\Error
log\housekeeping.txt",
8, TristateFalse)
f.Write Now() & " " & fOSUserName() & "some other meaningful text
here"
vbCrLf & _
""
f.Close
Rather than have this code repeated several times in each procedure where
I
want to log something, I would rather have this code stored as a module
and
then call it whenever needed. I would also need to add some text to it
which
will vary depending on where in the code I call it.
So:
You create a new code module (or use an existing one), just a standard
module.
You create a procedure in this module, where you put your code.
Instead of using literal "meaningful text", you apply a variable (call
it maybe cLine). This variable needs to be passed to the procedure: put
the name of the variable inside the brackets that come with the
procedure header, like this:
Sub LogLine(cLine as string)
Now, when you need your code to run, call it by name, like this:
LogLine "some meaningful text"
this executes all code between Sub LogLine() and End Sub, substituting
the actual text for the variable name.
I hope this answer is not too wordy!
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html