ITExperience.NET Rotating Header Image

Excel 2007 error: Different format than specified by the file extension



In some cases after upgrading to Excel 2007, you may get the following error:
The file you are trying to open .xlsx is in a different format than specified by the file extension. verify the file is not corrupted and is from trusted source before opening the file. Do you want to open the file now?

This errors particularly occurs when you’re trying to open an XLS file (Excel 2000-2003) with Excel 2007. In most cases, the problem can be solved by defining MIME types and associating them with extensions.
When you’re using a Document Management System (like Sharepoint or Livelink), you can try adding these:
.xls = application/msexcel
.xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

However, if you don’t want to look for a solution, but just want to solve the problem, insert this key in your registry to suppress the notification:

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security]
“ExtensionHardening”=dword:00000000

You can accomplish the above by doing the following:

  1. Open your Registry (Start -> Run -> regedit.exe)
  2. Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY
  3. Right click in the right window and choose New -> DWORD
  4. Type “ExtensionHardening” as the name (without the quotes)
  5. Verify that the data has the value “0″

32 Comments

  1. Ananth says:

    This really works !

    Thank you,

    Ananth  

    (Quote)

  2. Anon says:

    rigo: THANKS!!, IT REALLY WORKS.
    BEST REGARDS.  

    Hey Thanks For it Awesome its working  

    (Quote)

  3. Jitendra Kumar says:

    it really worked for me.Thanks for the solution  

    (Quote)

  4. thanks for you friend but I use and try it  

    (Quote)

  5. Sridhar Gumpula says:

    Hi,
    wow great solution its working fine
    thank you for your solution

    Sridhar Gumpula  

    (Quote)

  6. rigo says:

    THANKS!!, IT REALLY WORKS.
    BEST REGARDS.  

    (Quote)

  7. zafar says:

    sir
    i have tried your trick, file become open with out any error but the content of file become changed in 0 1 and others alphabatic, please hel me out  

    (Quote)

  8. Kesavan says:

    I will try in all the possible cases and let you know.  

    (Quote)

  9. Yawar Abbas says:

    hi
    ive tries your trick , now i m not getting the error msg , but file is still corrupt all i c is special character but no data.
    can u help me with that
    thank u  

    (Quote)

  10. Kesavan says:

    We tried by setting in registry. Its working fine.
    Eventhough is there any other way?.
    Pls advice.  

    (Quote)

  11. Narender says:

    even i am same face if u found any solution let me

    Thank you,
    Narender

    Umesh: I tried above solution and it works fine for me. But i don’t want to do any changes in registry .Is there any other solution ?
    I am using c# and asp.net 2.0 . Here i am export grid view in excel file and when i opened excel file that time above warning message i am facing .
    Regard,
    Umesh.

      

    (Quote)

  12. acrwebline says:

    Do you have a solution for Vista? The registry values as explained must be in XP only, because the information is not found in the visa registry. Can you confirm. Thank you.  

    (Quote)

  13. Surender says:

    I had changed the registry values as suggested. I could able to open the files
    without any error this is great and I am getting a blank worksheet and I am worried about my data. Any work around this to retreive my data back.
    Thanks,
    Surender.  

    (Quote)

  14. venkat says:

    Even changed the setting the ContentType for XLS as well as XLSX
    I am getting the same problem with the error mesg “Different format than specified by the file extension”

    Jon Where I have to add code “FilFormatNum” , cna you please give examples  

    (Quote)

  15. Jon says:

    This error is commonly caused when .SaveAs VBA code (or export from an application) specifies the file should be created as filename.xls whilst saving in 2007 (i.e. xml) format.

    When this file is then opened:

    - In Office 2007 you get the format file extension error but it will open and work fine
    - In Office 97-2003 the file will open but will appear corrupted as 97-2003 cannot interpret xml files

    The solution from a macro perspective is to modify the code to specify the file format by adding the following code if you need to share with people on older excel (this will make it save in .xls format as well as be named . xls):

    FileFormatNum = 56
    or
    FileFormatNum = xlExcel8

    If only sharing with 2007 users, modifying the filename to be filename.xlsx will also solve this issue (this can also be done manually if files are only used by 2007 users).

    Hope this helps  

    (Quote)

  16. Ankit says:

    nothing worked.. all tried .. changed .xls to .xlsx and changed in registry as well.
    Any other solution..  

    (Quote)

  17. Jayesh says:

    No complicated reg settings or modifications, just rename the .xls extension to .xlsx, you are done.  

    (Quote)

  18. Umesh says:

    I tried above solution and it works fine for me. But i don’t want to do any changes in registry .Is there any other solution ?
    I am using c# and asp.net 2.0 . Here i am export grid view in excel file and when i opened excel file that time above warning message i am facing .

    Regard,
    Umesh.  

    (Quote)

  19. Sashikant says:

    Thanks God….Its working..Thanks to UUUUUUUU too  

    (Quote)

  20. Sreekanth says:

    Inspite of setting the ContentType for XLS as well as XLSX…I am getting the same problem with the weird mesg “Different format than specified by the file extension”

    Any help is highly appreciated

    -Sreek  

    (Quote)

  21. Ahmad says:

    I don’t have security folder. I added the same under ..\EXCEL\ folder and it didn’t work  

    (Quote)

  22. Trevor says:

    Hi I tried adding HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY
    but my excel documents are still corupt. any help please  

    (Quote)

  23. Ranjan ROy says:

    Thank pal..It really hepled me  

    (Quote)

  24. anon says:

    Thank you so very much. I’ve been pestered by that annoying pop-up for months; I deal with a very large number of Excel files that don’t have an extension and constantly throw this error. This has seriously given me 5 minutes of my day back.  

    (Quote)

  25. zlatan24 says:

    I heard about not bad application-xlsx repair Microsoft, know how will display a dialog box with the question whether this worksheet should actually be scanned, also with help it you may try to open the necessary *.xls, *,xlt, *.xlsx, xlsm, *.xltm, *.xltx, *.xlam file and see an error message on the screen instead of it: Microsoft Excel unable to read file, This file is not in a recognizable format, etc.  

    (Quote)

  26. Far says:

    hi
    ive tries your trick , now i m not getting the error msg , but file is still corrupt all i c is special character but no data.
    can u help me with that
    thank u  

    (Quote)

  27. Saravanan says:

    Thanks for solution  

    (Quote)

  28. Rebecca says:

    Thank you! As a non techie…your instructions were great! It took care of the problem.  

    (Quote)

  29. Samita says:

    Its working!!!!! wonderful….  

    (Quote)

  30. Ted says:

    Thanks a lot.  

    (Quote)

  31. Vasanth says:

    Hi ,

    I have already tried the above solution , it’s working. But i want the solution in the way that from the jsp code. If you find any solution
    i will be very happy.

    Thanks,
    vasanth.  

    (Quote)

  32. Hi,

    Your solution really worked.Its excellent.

    Thanks,

    Amber Bhatnagar.  

    (Quote)

Leave a Reply

Comments without hyperlinks are immediately visible. However, if you post a comment that includes a hyperlink, your comment requires approval. This can take up to one day.