Forum Discussion

googleid_104060's avatar
googleid_104060
Occasional Contributor
13 years ago

TestComplete 9 and Windows 8 Plaback Issues

Hi,



I am running testcomple9 on windows8 and  I would like to post issues and get answers through this thread.



So first issue is...



msExcel.ActiveWorkBook.SaveAs(NewReport)



The above statement used to run with out error in testcomplete8 on all OSs(not Windows8) and save the generated excel as NewReport.



But in testcomplete9 it is giving error like.... Object required 'msExcel.ActiveWorkBook'.





Please let us know any syntax changes needed for version 9.



Regards,

Rama
  • googleid_104060's avatar
    googleid_104060
    Occasional Contributor
    same script running perfectly on WINXP machine.. dont know wts wrong with Window8 OS.
  • Hi Rama,



    Sorry for asking an obvious question, but still is Excel installed on your Windows 8 computer? According to this feature matrix, it's only bundled with Windows RT edition:

    Announcing the Windows 8 Editions



    Your script seems to be using the Excel COM object - Excel.Application - so it won't work without Excel installed on the computer.
  • googleid_104060's avatar
    googleid_104060
    Occasional Contributor
    Hi Helen,



    Thanks for your reply.



    Yes I have installed Excel in my system.



    I will tell you the whole procedure...



    My script will generate the excel report in my application.. and should save that report in specified path.



    once excel report is generated..

    Here is the script...




    Set objFSO = CreateObject("Scripting.FileSystemObject")


    If objFSO.FileExists(NewReport) Then

        objFSO.DeleteFile(NewReport)


    End If

    Set msExcel_Report = GetObject(,"Excel.Application")


    msExcel_Report.Visible = "True"


    msExcel_Report.ActiveWorkBook.SaveAs(NewReport)



    For the last line I am getting error. After msExcel_Report.Visible = "True"a closed excel(excel without even empty sheet) sheet is opening, this is the one I am getting difference from other OSs.



    Regards,

    Rama






     


  • googleid_104060's avatar
    googleid_104060
    Occasional Contributor
    Set msExcel_Report = GetObject(,"Excel.Application")

    msExcel_Report.Visible = "True"






    so an excel is opening without workbook.. that is the main cause for the error i am getting.

    It is not like that in other OSs...it just get focus on generated excel sheet and save that in specified path.



    Regards,

    Rama
  • Hi Rama,



    You can check if a workbook is open in Excel, and create (or open) the workbook if needed:

    If msExcel_Report.ActiveWorkBook Is Nothing Then

      msExcel_Report.Workbooks.Add

      ' -- or --

      ' msExcel_Report.Workbooks.Open(FileName)

    End If

      msExcel_Report.ActiveWorkBook.SaveAs(NewReport)


    Is this what you need?