Wim Gielis wrote: ↑Thu Sep 10, 2020 4:01 pm
Then I would suggest AsciiOutput in the Prolog tab to a text file and execute it in the Epilog tab.
Yes, that's a good idea.
But the file with VBscript is unloaded with the text in quotes.
I tried closing quotes both at the beginning and at the end. Unfortunately, such a file does not work.
Script, which not working:
Code: Select all
""
Option Explicit
Const xlCurrentPlatformText = -4158
Dim strInputExcelFile, strOutputTextFile
With WScript
If .Arguments.Count <> 2 Then
.Echo "Missing_parameters"
.Quit
Else
strInputExcelFile = .Arguments(0)
strOutputTextFile = .Arguments(1)
End If
End With
With CreateObject("Excel.Application")
With .Workbooks.Open(strInputExcelFile)
.Worksheets(1).UsedRange.NumberFormat = "General"
.SaveAs strOutputTextFile, xlCurrentPlatformText
.Close 0
End With
.Quit
End With
""
When I manually remove the quotes or use the prepared file with this script, it works fine.
TI-code:
Code: Select all
sScript = '
"
' | Char(10) | '
Option Explicit
' | Char(10) | '
Const xlCurrentPlatformText = -4158
' | Char(10) | '
Dim strInputExcelFile, strOutputTextFile
' | Char(10) | '
With WScript
' | Char(10) | '
If .Arguments.Count <> 2 Then
' | Char(10) | '
.Echo "Missing_parameters"
' | Char(10) | '
.Quit
' | Char(10) | '
Else
' | Char(10) | '
strInputExcelFile = .Arguments(0)
' | Char(10) | '
strOutputTextFile = .Arguments(1)
' | Char(10) | '
End If
' | Char(10) | '
End With
' | Char(10) | '
With CreateObject("Excel.Application")
' | Char(10) | '
With .Workbooks.Open(strInputExcelFile)
' | Char(10) | '
.Worksheets(1).UsedRange.NumberFormat = "General"
' | Char(10) | '
.SaveAs strOutputTextFile, xlCurrentPlatformText
' | Char(10) | '
.Close 0
' | Char(10) | '
End With
' | Char(10) | '
.Quit
' | Char(10) | '
End With
' | Char(10) | '
"
';
ASCIIOutput(csScriptPath, sScript);
Maybe you have an opportunity to suggest what can be fixed in this situation?