Author |
|
RichardL Senior Member
Joined: December 29 2008 Location: United States
Online Status: Offline Posts: 165
|
Posted: March 11 2010 at 22:18 | IP Logged
|
|
|
OK, I'm in quote hell tonight. I've an trying to archive my event log and trim it via a nightly VBS routine.
This works:
rv = PH.Formula("PH_ExportEventLog(PH_RelativeDateTime(Today(), -1440), PH_RelativeDateTime(Today(), 0), 0, ""C:\Program Files\Powerhome\Logs\EL1.XLS"", 1, 0)")
This does not Work:
strEventLogFileName = "C:\Program Files\PowerHome\Logs\EventLog_" & Year(Now) & Right("0" & Month(Now), 2) & Right("0" & Day(Now), 2) & ".Log"
rv = PH.Formula("PH_ExportEventLog(PH_RelativeDateTime(Today(), -1440), PH_RelativeDateTime(Today(), 0), 0, strEventLogFileName, 1, 0)")
I've tried many many combinations, nothing works, except hardcoding the filename, which I do not want to do, since I want the date embedded in the filename. I could always run it hardcoded then do a rename, but that not really nice...
Any help is appreciated!
Thanks,
Richard
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 11 2010 at 22:26 | IP Logged
|
|
|
I havent tested it, but give this a try:
Code:
rv = PH.Formula("PH_ExportEventLog(PH_RelativeDateTime(Today(), -1440), PH_RelativeDateTime(Today(), 0), 0,""" + strEventLogFileName + """, 1, 0)")
|
|
|
Dave.
|
Back to Top |
|
|
RichardL Senior Member
Joined: December 29 2008 Location: United States
Online Status: Offline Posts: 165
|
Posted: March 11 2010 at 22:41 | IP Logged
|
|
|
Works!!!
So I got curious.
A variation also works:
rv = PH.Formula("PH_ExportEventLog(PH_RelativeDateTime(Today(), -1440), PH_RelativeDateTime(Today(), 0), 0,""" & strEventLogFileName & """, 1, 0)")
This does not Work:
strEventLogFileName = "C:\Program Files\PowerHome\Logs\EventLog_" & Year(Now) & Right("0" & Month(Now), 2) & Right("0" & Day(Now), 2) & ".Log"
strEventLogFileName = Chr(34) & Chr(34) & Chr(34) & strEventLogFileName & Chr(34) & Chr(34) & Chr(34)
rv = PH.Formula("PH_ExportEventLog(PH_RelativeDateTime(Today(), -1440), PH_RelativeDateTime(Today(), 0), 0, strEventLogFileName, 1, 0)")
Thanks for saving the day!
Richard
|
Back to Top |
|
|
|
|