# vbs help



## animelover72 (Jul 30, 2009)

Hi,
I want to convert a xls to a csv using vb script.
So far, I've found a code which does the job if you drag and drop it, but I would like to make it so that I need to run the script by clicking it instead of dragging and dropping and that it'll use a specific file ie.C:\SCRIPTS\TEST.XLS . Please help

Code is taken from *wiere* from go4expert.com

```
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
```


----------



## animelover72 (Jul 30, 2009)

never find. i got it 

```
Set objExcel = CreateObject("Excel.application")
    set objExcelBook = objExcel.Workbooks.Open("C:\SCRIPTS\TEST.xls")

    objExcel.application.visible=false
    objExcel.application.displayalerts=false

    objExcelBook.SaveAs "C:\SCIPTS\TEST.csv", 23

    objExcel.Application.Quit
    objExcel.Quit   

    Set objExcel = Nothing
    set objExcelBook = Nothing

WScript.Echo "Done"
```


----------

