Forum Discussion

tcarey's avatar
tcarey
Occasional Contributor
5 years ago
Solved

sending keystroke to Excel

I am trying to send keystroke to Excel Screen but seems like it is not working.

Sys.Process("EXCEL").Window("XLMAIN", "*", 1).Window("XLDESK", "", 1).Window("EXCEL7", "*", 1).Keys("[F6][F6]")  I used this command but seems it's not sending at all.

 

I'm new to Testcomplete ..any help would appreciate it.

 

Thank you

  • Okay.  There are a couple of things here.  

     

    Can I ask why you are testing Excel and Oracle?  Is the data upload something to do with your application?  The reason I ask is that most people are testing their own app and adding other apps into the mix can unnecessarily complicate things.  Can you give us a bigger overview of what you are trying to do?

     

    Second, if you are going to use Excel this way, then the best way to handle this is when the test fails.  When you get the error, and before TestComplete closes, you'll want to check and see if Excel is still open and close the file properly.

6 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Yes, we can probably help, but what are you trying to do in Excel exactly?  There may be an easier way to do it.

    • tcarey's avatar
      tcarey
      Occasional Contributor

      Hi Marsha 

       

      We have a test where we have to open Excel then enter the data then upload to Oracle.  Sometimes we get this Document Recovery screen (see attached screen shot) and there is not a short cut to close this screen.  We tried to clicking the "close" button but sometimes ti works and sometimes it doesn't.  Alternative way I found out that I can do F6 twice and TAB 3 times ..it navigates to close button.  I could not find anywhere to have that option turned off, other than modify something in the registry (which I wanted to avoid).  Any suggestion?  Also,  I am trying to do the "if" statement,  if that Document Recovery screen is there then close the screen... If statement is not working either. 

      Thank you for the help 

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        You're getting the Document Recovery screen because your Excel sheets are not being saved properly so Excel is finding copies when you open it again.  I think it would be better to fix that rather than trying to deal with this window.  

         

        Once you've entered the data in Excel and you send it to Oracle, are you going through the Save process?

         

        And I'll be curious again, why the need to use Excel for the data entry?  Can you use a text file instead?