Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting excel to tab delimited

Status
Not open for further replies.

ehabaziz20012001

Programmer
Jan 13, 2006
10
EG
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 .

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
 
What is the difference? You may need to define TextCodepage and Local optional arguments of SaveAs method.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top