KB-34325: Date/time values in filenames.

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:


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”

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *