Saturday, April 3, 2010

How to convert an Excel file to CSV file?

How to convert an Excel file to CSV file?

Write the below code in a notepad and save it as a .VBS file. now drag and drop your excel file onto this .vbs file.

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

[Via]