Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I'm trying to use a VB macro inside the QV loading script in order to write an activity log, but I'm not having luck.
First, this is the code included in the macro section:
Dim objFSO
Dim logFile
Function openOutputFile(filename)
Rem *** Create and open an output file
CONST ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set openOutputFile = objFSO.OpenTextFile(filename, ForWriting, True)
End Function
CONST LOGFILE_NAME = "D:\tmp\test1.log"
Function WriteLog(message)
logFile = openOutputFile(LOGFILE_NAME)
logFile.WriteLine(message)
logFile.Close
End Function
and inside the QV script, (i.e. in Main tab) the WriteLog function is invoked:
LET x = WriteLog("test");
The file is being created, but it is empty.
Could you please provide some advice
Thanks in advance!
Regards,
Jesús
Hi Jesús,
Just change this line
logFile = openOutputFile(LOGFILE_NAME)
to this line
Set logFile = openOutputFile(LOGFILE_NAME)
That should work.
Miguel
Hi Jesús,
Just change this line
logFile = openOutputFile(LOGFILE_NAME)
to this line
Set logFile = openOutputFile(LOGFILE_NAME)
That should work.
Miguel