vba 2007 ActiveWorkbook.SaveAs problem

vba 2007 ActiveWorkbook.SaveAs problem

在使用vba保存生成的excel文件后,然后在打开总是提示格式不对,不管提示,进入后格式时对的,数据也可以显示。

最后google之,原来在2003之后使用ActiveWorkbook.SaveAs时必须指定文件类型。

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)

http://blogs.office.com/b/microsoft-excel/archive/2009/07/07/use-the-vba-
saveas-method-in-excel-2007.aspx