Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have to import a lot of execl-files and add some every week.
Now i want to build up a Logfile to Log the Date and filename of any import.
How can i do this
Thx
Chris
Here is some macro code that I use to log when data is exported, which you could adapt for your needs. It uses activedocument that obviously cannot be used in a script but you wont need to anyway - invoke your routine and pass it the details you want written to the log.
set doc=ActiveDocument
vExport = doc.Variables("vExport").GetContent.String
if vExport = "1" then
' ************ log successful export ************
vExportLog = doc.Variables("vExportLog").GetContent.String
set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
set logFile = fso.GetFile(vExportLog)
if err <> 0 then ' file does not exist
on error goto 0
set logFile = fso.CreateTextFile(vExportLog)
set logFile = fso.GetFile(vExportLog)
else
on error goto 0
end if
set txsStream = logFile.OpenAsTextStream(8) ' append
txsStream.WriteLine Now & " " & vExportTo & " created by " & doc.GetProperties.FileName
txsStream.Close
end if
Regards,
Gordon