Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Excel File Conversion SaveAs Excel.Application XLS XLSX XLSM
;Convert .XLS to .XLSX xlWorkbookDefault = 51 ; Workbook default dir = "C:\data\" inputfile = AskFilename( 'Choose Excel File to Convert', dir, 'XLS Files|*.xls', '', 1 ) outputfile = FilePath(inputfile):FileRoot(inputfile):'.xlsx' objExcel = ObjectCreate("Excel.Application") objExcel.DisplayAlerts =@FALSE ; this prevents the warning message from coming up objWrkbks = objExcel.Workbooks objWrkbks.Open( inputfile ) objActWrkbk = objExcel.ActiveWorkbook objActWrkbk.SaveAs(:: Filename=outputfile, FileFormat=xlWorkbookDefault, Password="", WriteResPassword="", ReadOnlyRecommended=@FALSE, CreateBackup=@FALSE) objWrkbks.Close() objConst = 0 objActWrkbk = 0 objWrkbks = 0 objExcel = 0
;Convert .XLSM to XLS dir = "C:\data\" xlsmfile = AskFilename( 'Choose Excel File to Convert', dir, 'XLSM Files|*.xlsm', '', 1 ) xlsfile = FilePath(xlsmfile):FileRoot(xlsmfile):'.xls' objExcel = ObjectCreate("Excel.Application") objConst = ObjectConstantsGet(objExcel) objExcel.DisplayAlerts =@FALSE ; this prevents the warning message from coming up objWrkbks = objExcel.Workbooks objWrkbks.Open(xlsmfile) objActWrkbk = objExcel.ActiveWorkbook objActWrkbk.SaveAs(:: Filename=xlsfile, FileFormat=objConst.xlExcel8, Password="", WriteResPassword="", ReadOnlyRecommended=@FALSE, CreateBackup=@FALSE) objWrkbks.Close() objConst = 0 objActWrkbk = 0 objWrkbks = 0 objExcel = 0
Article ID: W18106
Filename: Excel File Conversion Using SaveAs.txt
File Created: 2013:01:18:13:27:34
Last Updated: 2013:01:18:13:27:34