Michael Kuzmin

personal blog

Batch convert XLSX to XLS with VBS

February16

If you have Excel 2007 installed  and you are looking for a way to convert XLSX ->XLS using windows shell (batch script, etc.) here’s the perfect solution:

1) copy this code and save it is as xlsx2xls.vbs  OR simply download it

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(Wscript.Arguments(0))
objExcel.Application.Visible = False
objExcel.Application.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs Wscript.Arguments(1), 56
objExcel.ActiveWorkbook.Close
objExcel.Application.DisplayAlerts = True
objExcel.Application.Quit
WScript.Quit

2) in your batch script you can call it by doing this

c:\xlsx2xls.vbs "C:\inputdocument.xlsx" "C:\outputdocument.xls"

don’t mix up the order, don’t mix up file extensions, don’t mix up file paths because if you do it will overwrite your existing stuff without prompting.. and of course you will have to write this last command in one line ;-)

  
Tagged with:
2 Comments to

“Batch convert XLSX to XLS with VBS”

  1. On March 5th, 2010 at 12:33 pm Sasha Says:

    You should write here more often!

  2. On July 7th, 2010 at 11:52 pm Michael Kuzmin Says:

    i know…i know… i should and i will =)

Email will not be published

Website example

Your Comment: