I am getting the following error warning when opening an .xls file generated using 'CarlosAg.ExcelXmlWriter.dll' in Excel 2007:

The file you are trying to open,'', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

Any ideas how I can resolve this?


It seems that the .xls file (Microsoft Excel 97-2003 format) is actually an .xlsx file (Microsoft Excel 2007 format). Changing the file extension from .xls to .xlsx should clear the warning message.


In your VBA code, use this command:

Application.DisplayAlerts = False

this will suppress any such warnings.


It's xml spreadsheet 2003 format, the correct extension is xml which is why it does not need excel installed.

  • I think you meant to say .xlsx, not .xml? – SamB Jan 13 '14 at 5:51
  • This is not an answer. This is a comment. If you found something helpful to you, then you should just up vote that question or answer. If you want to leave a comment, you should leave a comment. You need at least 50 reputation points to comment, but they are not hard to earn if you positively contribute to the site. – JakeGould Dec 17 '15 at 18:15

I tried changing the file extension to several extensions -- but the error always came up. I tried changing the settings in the registry -- but the error still appeared (I do not have admin rights and group policy probably overrides). I added [Application.DisplayAlerts = False] to my macro and it works!

protected by JakeGould Dec 17 '15 at 18:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.