Forum Discussion

sauerkraut's avatar
sauerkraut
New Contributor
10 years ago

Excel cannot open the archive

Hello,



I am having problems with an xlsx file. One of my tests runs OK on a machine but NOT in another. An is presenting the message as follow:



"O Excel não pode abrir o arquivo 'TC_01.xlsx' porque o formato ou a extensão de arquivo não é válida. Verifique se o arquivo não está corrompido e se a extensão corresponde ao formato do arquivo."



That's brazilian portuguese.



In english, I think the message is something like this:



"Excel cannot open the TC_01.xlsx' file because the format or extension is not valid. Verify if the file is not corrupted and if the extension corresponds to the format of the archive."



Some ideas?

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Cristiano,



    Can you post here the code that produces the error?

    I guess that the required driver may be absent on the problematic machine.

    Have a look at the 'ExcelDriver Method' help topic, there is a chance that it might address your problem.
  • sauerkraut's avatar
    sauerkraut
    New Contributor


    Yes, Excel version os the same at my machines. It is the 2007 version.



    The error occurs at the third line of my code:



    var storedFilesPath = Project.Path+"Stores\\Files";



    var Excel = Sys.OleObject("EXCEL.Application");



    Excel.Workbooks.Open(storedFilesPath+"\\"+arquivo.Name);



    /*

    arquivo.Name = aqquires the excel file name by a loop routine that searches all xlsx files in storedFilesPath directory

    */


  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Cristiano,



    The error comes from Excel; it has nothing to do with TestComplete.



    Try the following:


    • Rename the file from .xlsx to .xls (the file might have been saved with a wrong extension).


    • Make sure the file is not corrupted. This reportedly happens to files received by email, downloaded from the Internet, copied over the network, or if the disk has bad sectors. To repair the file, try opening it using the Open and Repair option in Excel.


    • Scan your computer for viruses (more info).


    • Suppress the error by editing the registry, as explained here.


    • Make sure the file is not being edited by several users.


    • Repair the Microsoft Office installation.




    You can also search for the error message on the Internet to see what solutions other people came up with.