Question:
How can I configure a file name to be a date/time interval, defined in Setpoints? If I try to use the example below, a script error is returned:
How can I configure a file name to be a date/time interval, defined in Setpoints? If I try to use the example below, a script error is returned:
Report.Export “EXCEL”, “C:\Report-” & Screen.Item(“SPdata1″).Value & ” á ” & Screen.Item(“SPData2”).Value & “.XLS”
Solution:
The problem is that the value of the Setpoint has invalid characters (“/” and “:”) for Windows files names. The solution is to replace these characters for valid ones, via Replace method. Example:
dxi = Screen.Item(“SPdata1”).Value
dxi = Replace(dxi,”/”,”-“)
dxi = Replace(dxi,”:”,”-“)
dxf = Screen.Item(“SPdata2”).Value
dxf = Replace(dxf,”/”,”-“)
dxf = Replace(dxf,”:”,”-“)
Set Report = Application.LoadReport(“[Report]”)
Report.Export “EXCEL”, “C:\Report-” & dxi & ” á ” & dxf & “.XLS”