香港新浪網MySinaBlog 精選話題工具
« 上一篇 | 下一篇 »
Emily | 1st Jul 2008, 12:37 PM | Excel 2007 | (2002 Reads)

Use VBA SaveAs in Excel 2007

 Information

If you run the code in Excel 2007 it will look at the FileFormat of the parent workbook and save the new file in that format.
Only if the parent workbook is an xlsm file and if there is no code in the new workbook it will save the new file as xlsx,
If the parent workbook is not an xlsx, xlsm, or xls then it will be saved as xlsb.

This are the main formats in Excel 2007 :

51 = xlOpenXMLWorkbook (without macro's in 2007, xlsx)
52 = xlOpenXMLWorkbookMacroEnabled (with or without macro's in 2007, xlsm)
50 = xlExcel12 (Excel Binary Workbook in 2007 with or without macro’s, xlsb)
56 = xlExcel8 (97-2003 format in Excel 2007, xls)

More details and examples: http://www.rondebruin.nl/saveas.htm

 

XlFileFormat Enumeration

http://msdn.microsoft.com/en-us/library/bb241279.aspx