Archive for August 9th, 2012

Script to Convert XLS to XLSX

Wrote this little diddy to convert an Excel 2003 file to Excel 2010 file.


' http://technet.microsoft.com/en-us/library/ff198017.aspx
Const xlExcel12 = 50
Set oExcel = CreateObject("Excel.Application")

' Set below value to false to hide the Excel window
oExcel.Visible = True

' Convert
Set oWorkbook = oExcel.Workbooks.Open("C:\filename.xls")
Set oWorksheet = oWorkbook.Worksheets(1)
oWorkbook.SaveAs "C:\filename.xlsb", xlExcel12 

' End
oExcel.quit (oWorkbook.Close)

Leave a Comment

Follow

Get every new post delivered to your Inbox.

Join 59 other followers