These are the main file formats in Excel 2007-2010:
51 = xlOpenXMLWorkbook (without macro's in 2007-2010, xlsx)
52 = xlOpenXMLWorkbookMacroEnabled (with or without macro's in 2007-2010, xlsm)
50 = xlExcel12 (Excel Binary Workbook in 2007-2010 with or without macro's, xlsb)
56 = xlExcel8 (97-2003 format in Excel 2007-2010, xls)
Note: I always use the FileFormat numbers instead of the defined constants
in my code so that it will compile OK when I copy the code into an Excel
97-2003 workbook. (For example, Excel 97-2003 won't know what the
xlOpenXMLWorkbookMacroEnabled constant is.)
But In Excel 2011 you must add 1 to each number.
xlsx = 52
xlsm = 53
xlsb = 51
xls = 57
Important to know this because SaveAs requires you to provide both the FileFormat
parameter and the correct file extension.
ActiveWorkbook.SaveAs "C:\ron.xlsm", fileformat:=52
On a Mac in Excel 2011 you must use this
ActiveWorkbook.SaveAs "C:\ron.xlsm", fileformat:=53
No comments:
Post a Comment