开发者

File is not in a recognizable format in Excel 2003 after running macro in Excel 2007

开发者 https://www.devze.com 2023-02-17 02:56 出处:网络
After installing Excel 2007, an excel macro, developed for Excel 2003, generates output that seems to be broken. The message开发者_StackOverflow that is populated says that \"The file is not in a reco

After installing Excel 2007, an excel macro, developed for Excel 2003, generates output that seems to be broken. The message开发者_StackOverflow that is populated says that "The file is not in a recognizable format".

I can open the outputted file myself in Excel 2007, but others cannot open it in 2003. It is also not sure if they can open in 2007 either.

Please advise on how to go about this. Is their a way to make it compatible for both versions? Which encoding shall I use?


You usually get that error when you don't use the FileFormat Argument in The SaveAs properly.

And if you want the users to open the file in Excel 2003 then ensure that you save it as Excel 2003 and use the correct file format. Here is an example

wb.SaveAs "C:\MyFile.xls", fileformat:=56

Where wb is your workbook object.

These are the commonly used fileformats

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

精彩评论

暂无评论...
验证码 换一张
取 消