Forum Discussion

subbu_valliappa's avatar
subbu_valliappa
Contributor
11 years ago

Excel file causes serious error when opened during TestComplete runs

In our TestComplete scripts that we run overnight, a particular script is setup to open Excel spreadsheet and copy its data. It has been running alright until lately when we have noticed an unexpected message when the Excel file is opened. It reads "The document caused a serious error the last time it was opened. Would you like to continue opening it?"



This only happens when TestComplete scripts are run, and so far can't be reproduced by opening the file manually. Is there something that I can do in the scripts to debug the file properties whenever it is opened? I would like to understand what is happening to the file when the scripts are run, and it has been tricky so far.



Any help would be greatly appreciated.

  • The issue occurs when the excel workbook is not closed property by terminating the excel application and opening the same file again and  the issue is related to excel application. may be try the following solution



  • murugans1011's avatar
    murugans1011
    Regular Contributor
    The issue occurs when the excel workbook is not closed property by terminating the excel application and opening the same file again and  the issue is related to excel application. may be try the following solution



  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Is it possible that you are opening the file during your scripts but then failing to close it properly?  It may be that the "error" being reported is some sort of improper exit or closure of the Excel process in windows.  Double check to make sure that, once your script is finished with the Excel spreadsheet, it is closing it properly.
  • Checked my script and it is closing the Excel file properly indeed.



    Can I insert some sort of debug messages or anything similar when the file is opened?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Murugan is basically backing up what I said... your script may be closing Excel... but some thing in the way you are closing it is doing it improperly.  Follow that MSN article and see if that helps.
  • Probably that is right. I'll look into the script further and see if there is anything odd there while closing the Excel file.



    In the meantime, the solution on the MSN website seems to work.



    Thanks for your help.