Forum Discussion

Vivek72's avatar
Vivek72
Contributor
11 years ago

Microsoft Office files fails to open while Test Complete is open

Hi,



I am using Test Complete 10.10 and I access my project files from Network folder. While Test Complete is open, I noticed Microsoft Office products in Network folder fails to open. It seems the excel process is running when I checked Task Manager at that moment. It is strange that the same files open with no issues if I close Test Complete. Any work around?

5 Replies

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    Most likely there is no error. What happens is that Excel NEVER opens multiple instances when opening a file. All the files are opened in the same process, with extra taskbar icons but a single window. So if you first instanciate in code an Excel.Application object, and fail to quit it properly (no more EXCEL.EXE in running processes), the next file you open opens up  within the same (invisible) instance. Just make sure you properly dispose of the object.



    Set objXl = CreateObject("Excel.Application")



    ...



    For Each wb In objXl.WorkBooks

        wb.save

        wb.Close

    Next



    objXl.Quit

    Set objXl = Nothing

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    It sounds like you are instanciating an Excel object in your script, and not disposing of it properly. The process stays opened. Your files are actually opening, you just can't see the main window.
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Can you explain further on "fails to open"? Does it give you a message about the file being in use? Are you using data-driven testing?

  • If there is a running process, certainly an error message appears. 


    Try using something like this.



    //excel...word..powerpoint..

    if (Sys.Process("EXCEL").Exists){


       Sys.Process("EXCEL").Terminate();


    }

  • Hi All



    I am not using Data-Driven Testing nor my scripts are hooked to any excel files. The problem is not just confined to excel files but Microsoft word too. To be sure I checked Task Manager if any Office related .exe files are running already before trying to open Microsoft files, so I can say no process was running already. But yes, if I close the default dialog  that is displayed usually before any office application opens, I can see the .exe process related to that file in the task manager still running. Sys.Process("EXCEL").Terminate()  or any such sort of commands are of no use because this issue is not created while script execution or after the script execution, it just happens if I open test complete and access project file from my Network location and then try to open any Office products from the same network location.



    Thanks for all suggestions.