1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Convert from XLS to CSV using VBScript

Discussion in 'Visual Basic ( VB )' started by wiere, Jun 25, 2009.

  1. wiere

    wiere New Member

    Realised used this site quite a lot without ever giving back to it, so i thought i'd change that.

    This script is nice and simple way of converting xls to csv simply drag the files onto the vbs to use.

    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)
        objExcelBook.SaveAs FileName & "csv", 23
        Set objExcel = Nothing
        set objExcelBook = Nothing
  2. shabbir

    shabbir Administrator Staff Member

    How do I drag the files to VBS.
  3. wiere

    wiere New Member

    Sorry i didnt explain. Save this vbs script and drag the XLS files onto it in windows explorer.
  4. wiere

    wiere New Member

    I'm sorry i missed the top line of code out. This needs to be the first line:

     Set objArgs = WScript.Arguments
    should work now
  5. shabbir

    shabbir Administrator Staff Member

    Added the first line to the code above.
  6. Click_talk

    Click_talk New Member


    How to make it to work for Multiple Tabl in the same Excel file.

    PLease help.


Share This Page