Forum Discussion

p_mariet's avatar
p_mariet
Occasional Contributor
10 years ago

Testcomplete opening Outlook instead of Excel VBScript

Hi,



I'm having a problem with TC and the microsoft suite. 



I'm trying to modify a cell in a table in a given tab of my Excel sheet, but when I call the worksheet, instead of opening Excel, Outlook pops up.



here is my sample code:



sPath = "\\SERVER\... .xlsx"



...




Set Excel = Sys.OleObject("Excel.Application")


Set varExcelOpenFile = Excel.Workbooks.Open(sPath)


Set varDataSheet = Excel.ActiveWorkBook.WorkSheets(strBuild)


Set varDataSheet.Cells(x,y)  = varPartId


Log.Message(dataSheet.Cells(x, y))





When I put breakpoints and run it step by step, every thing seems fine until the Set on varExcelOpenFile. 

When I browse through the Locals, ContentTypeProperties: "Error: This document must contain properties content type. These properties are required for file management system documents."

And then the next step opens Outlook.



My Office version is 2010 and my TC version is 9.31.



I think it's due to my Office version but I don't really know what to do.

Has anyone got a solution of a tip?



Thanks

3 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Pierrick,


     


    It looks like COM objects are mixed up somehow on your computer. Could you please do the following:


    1. Switch to TestComplete's Object Browser.


    2. Navigate to the Sys node.


    3. Find the OleObject property and specify Excel.Application there:




    4. What application name do you see? Is it Microsoft Excel?


    • LoganathanD's avatar
      LoganathanD
      New Contributor
      1. Switch to TestComplete's Object Browser.

      2. Navigate to the Sys node.

      3. Find the OleObject property and specify Excel.Application there:

      4. What application name do you see? Is it Microsoft Excel?

      - The above steps are not so clear

      - Could you pls give give screenshots of the sys node and what is the child that is selected to find the OleObject property?

  • p_mariet's avatar
    p_mariet
    Occasional Contributor
    Hello Tanya,



    I'll give it a try and let you know if it worked.



    Thank you :)