After experiencing a lot of down time, We decided to move this site to
CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.
xls to tab delimited file(txt)
|
Author |
Message
|
hajime
-
Total Posts
:
67
- Scores: 0
-
Reward points
:
0
- Joined: 7/27/2010
-
Status: offline
|
xls to tab delimited file(txt)
Thursday, September 02, 2010 6:14 PM
( permalink)
hi guys i need to convert an xls file into a tab delimited text file i've found this code that converts xls into csv ive tried to change it to make it tab delimited but it wont run. here's the original code: Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1 FullName = objArgs(I)
FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") ) Set objExcel = CreateObject("Excel.application")
set objExcelBook = objExcel.Workbooks.Open(FullName) objExcel.application.visible=false
objExcel.application.displayalerts=false objExcelBook.SaveAs FileName & "csv", 23 objExcel.Application.Quit
objExcel.Quit Set objExcel = Nothing
set objExcelBook = Nothing Next
|
|
|
|
ebgreen
-
Total Posts
:
8088
- Scores: 95
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:xls to tab delimited file(txt)
Friday, September 03, 2010 2:11 AM
( permalink)
In what way does it not run?
|
|
|
|
hajime
-
Total Posts
:
67
- Scores: 0
-
Reward points
:
0
- Joined: 7/27/2010
-
Status: offline
|
Re:xls to tab delimited file(txt)
Friday, September 03, 2010 5:55 PM
( permalink)
oh sorry for not telling it runs through drag and drop. anyways i've fixed this one too looks like i just need to change objExcelBook.SaveAs FileName & "csv", 23 into objExcelBook.SaveAs FileName & "txt", 46 thanks anyways
|
|
|
|
hajime
-
Total Posts
:
67
- Scores: 0
-
Reward points
:
0
- Joined: 7/27/2010
-
Status: offline
|
Re:xls to tab delimited file(txt)
Sunday, September 05, 2010 1:01 PM
( permalink)
aw my bad, it sould be 42 not 46. oh and ebgreen sorry i misunderstood your question the script runs perfectly it converts xml to csv(comma separated values) but what i wanted is to have an output of tsv(tab delimited) also ive tried to read the contents of the file(xml converted via code above) but the script cannot read the text so i tried to manualy convert the xls to tab delimited and tried again the script and its working would apreciate your help on this. because i've been stuck with this problem for two days now. and i can't seem to figure it out tried editing the tab files to look like the one i've converted manualy but still the same
<message edited by hajime on Sunday, September 05, 2010 7:35 PM>
|
|
|
|
hajime
-
Total Posts
:
67
- Scores: 0
-
Reward points
:
0
- Joined: 7/27/2010
-
Status: offline
|
Re:xls to tab delimited file(txt)
Sunday, September 05, 2010 8:08 PM
( permalink)
i think the reason is that not only it converts the file into tab but also it converts it into unicode. would appreciate your help on this
|
|
|
|
ebgreen
-
Total Posts
:
8088
- Scores: 95
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:xls to tab delimited file(txt)
Tuesday, September 07, 2010 2:13 AM
( permalink)
I would suggest reading the documentation for the SaveAs Method. There are a plethora of valid values for the second parameter. Try 24 instead of 23.
|
|
|
|
hajime
-
Total Posts
:
67
- Scores: 0
-
Reward points
:
0
- Joined: 7/27/2010
-
Status: offline
|
Re:xls to tab delimited file(txt)
Tuesday, September 07, 2010 12:29 PM
( permalink)
thanks ebgreen i've tried what you said but 24 also gives back a comma separated not tab
|
|
|
|
ebgreen
-
Total Posts
:
8088
- Scores: 95
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:xls to tab delimited file(txt)
Wednesday, September 08, 2010 2:03 AM
( permalink)
Can you manually save a file in the format that you want? If so, then record a macro.
|
|
|
|
Online Bookmarks Sharing: