ehabaziz20012001
Programmer
I compared the output of 2 text files . One is generated from the inside Excel application save as tab delimited text file and the other is generated from the below script .
There was a difference between the two text files . Any help ?
Why that I can not use the format -4158 with the below script though the 20,21 works .
There was a difference between the two text files . Any help ?
Why that I can not use the format -4158 with the below script though the 20,21 works .
Code:
Dim oBook
Dim Sheet
Dim Folder
Dim FileName
Const xlCurrentPlatformText = -4158
Set objArgs = WScript.Arguments
FullName = objArgs(I)
'FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") )
Set oBook = WScript.CreateObject("Excel.application")
oBook.Workbooks.Open(Wscript.Arguments.Item(0) &"\" &Wscript.Arguments.Item(1))
FileName=(Wscript.Arguments.Item(1))
Folder=(Wscript.Arguments.Item(0))
MsgBox FileName
oBook.application.visible=false
oBook.application.displayalerts=false
For Each Sheet In oBook.Worksheets
oBook.ActiveWorkbook.Worksheets(Sheet.Name).SaveAs Folder &"\" &FileName &"_" &Sheet.Name &".txt", xlCurrentPlatformText
'20
MsgBox FileName+Sheet.Name
Next
MsgBox "Finishing creations of "+FileName+".txt"
oBook.Application.Quit
oBook.Quit
Set oBook = Nothing
set oBookOpen = Nothing