mbt masai
 
Welcome !
         

                                
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)
0
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     

#1
    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)
    0
    In what way does it not run?
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
    #2
      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)
      0
      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
      #3
        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)
        0
        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>
        #4
          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)
          0
          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
          #5
            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)
            0
            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.
            "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
            Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
            http://www.visualbasicscript.com/m_47117/tm.htm
            #6
              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)
              0
              thanks ebgreen i've tried what you said but 24 also gives back a comma separated not tab
              #7
                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)
                0
                Can you manually save a file in the format that you want? If so, then record a macro.
                "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
                Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
                http://www.visualbasicscript.com/m_47117/tm.htm
                #8

                  Online Bookmarks Sharing: Share/Bookmark

                  Jump to:

                  Current active users

                  There are 0 members and 1 guests.

                  Icon Legend and Permission

                  • New Messages
                  • No New Messages
                  • Hot Topic w/ New Messages
                  • Hot Topic w/o New Messages
                  • Locked w/ New Messages
                  • Locked w/o New Messages
                  • Read Message
                  • Post New Thread
                  • Reply to message
                  • Post New Poll
                  • Submit Vote
                  • Post reward post
                  • Delete my own posts
                  • Delete my own threads
                  • Rate post

                  2000-2012 ASPPlayground.NET Forum Version 3.8
                  mbt shoes www.wileywilson.com