Forum Discussion

andrewa's avatar
8 years ago

"OleObject" does not exist, TestComplete 12.2

So we recently moved from TestComplete version 9 to 12.2. We have a number of tests that read and write data from Excel spreadsheets. I started to have problems with the JScript we use to access the sheets.


This is the line of code that keeps erroring out:


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


And the error message I get is: 


You are trying to call the "OleObject" method or property of the "Sys" object that does not exist.

I'm rather confused because when I type into the editor, it keeps giving me the autocomplete option for an OleObject.
I am running with a Windows 7 Enterprise operating system (64-bit) and I have Excel 2016 . I've tried running TestComplete as admin to see if it would solve the issue, but no difference.
Do I need to try some different code?
  • Not sure... the variable assignment is assigning to a property, not necessarily calling a method that returns.  So... it could be that you do need some sort of delay.


    What I would do is add


    Sys.WaitProcess('Excel', 10000)

    I did a quick smoke test of this and, yes, there IS a bit of a delay before the application is running.  Give this a try and see if this helps.

12 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    Your code is correct and I've done a quick test of it myself here.

    If you go in your project to the Object Browser and click on the Sys node there, make sure that the OleObject property is present.  If so, click on the Params button and enter in Excel.Application there.  Make sure that this works just to double check.

    So, question... how are you calling that line?  Are you executing it directly or is that contained in some method that is stored elsewhere?  

    The reason being is that the message being returned seems to indicate that the Sys object ITSELF doesn't exist.  It's not a problem with OleObject... which kinda means, to me, that you might be calling that JScript code in a different context where the Sys object is not present.

    • andrewa's avatar

      In the object browser, I'm not even seeing an OleObject under the Sys node. It's really odd. (see the attached screenshot)


      One of my Keyword tests calls the JScript code.


      Honestly, I'm taking over maintaining the code from someone else, so there's quite a few things I don't quite understand. One of the issues is that our JScript code is probably pretty bloated. I might be missing something that runs and alters the state of things.


      Also, the error vanished after I made this post, and I started getting a 'The remote server machine does not exist or is unavailable' while trying to access the excel file on a local drive.

      • tristaanogre's avatar
        Esteemed Contributor

        In the screenshot of your object browser, if you click on the link to show advanced view, you should see the OleObject.  


        As for the rest of it... it's almost like you're stepping on some memory somewhere... any idea what the overall memory usage is at that point in your tests?