Forum Discussion

msap's avatar
Frequent Contributor
7 years ago

selecting an option from multiple submenuoptions.



when I run below Script ,  script does not select option(  Export... \excel.. \new workbook) from multiple menu options. just stops .


Could you please let me know what I am missing here.


Aliases.Framework.DividendEditorForm.splitContainerControl1.SplitGroupPanel2.accrualGrid.XtraPopupMenu.Click("Export...|Excel...|New Workbook");


gives below Error


System.InvalidCastException: Unable to cast COM object of type 'System.__Com Object' to class type 'System.Reflection.MemberInfo'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
   at SmartBear.TestComplete12.Hook.MarshalHelper.CastIUnknownToMemberInfo(Object obj).




6 Replies

  • Marsha_R's avatar
    Champion Level 3

    Not sure what that error is, but what are you trying to accomplish in Excel?  Maybe we can find you an easier way to do it.

    • msap's avatar
      Frequent Contributor

      yes there is an export to excel via new workbook in three different sub-menu option in the grid. Could you please let me know. in the previous post there is an attachment. 

      • tristaanogre's avatar
        Esteemed Contributor

        My question: Why are you automating the UI of Excel?  If you need to manipulate an Excel file, including exports and such, you can access Excel via the COM object for the Excel.Application.


        What is your ultimate end goal in your test that you are writing?  The error you're getting sounds like it's coming directly from TestComplete... you might need to contact support directly for that.  However, if your test doesn't EXPLICITLY need to interact with the Excel application but only needs to manipulate the file, you would probably benefit from some other methodology.