Ask a Question

sending keystroke to Excel

SOLVED
tcarey
Occasional Contributor

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

6 REPLIES 6
Marsha_R
Champion Level 2

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
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 excel document recovery.jpg

Marsha_R
Champion Level 2

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?

 

 

tcarey
Occasional Contributor

Reason why the Document Recovery screen shows up sometimes.. (I think)  is when the test fails middle of entering data in Excel - it stops the test without saving.  Then when I run again,  Excel thinks the file was ended abruptly and hence gives that screen.

 

The reason for the Excel is  due to  part of the Oracle functionality we are trying to test.  

Test is log in Oracle as a user, navigate to appropriate screen download the Excel, enter the data then there is an build in macro that uploads the file back to Oracle.  It is giving user option to bulk upload the data into Oracle.   Any suggestion on best way to do this?  I am no expert in TestComplete so I am lost. 

Thanks

bulk upload screen.jpg

Marsha_R
Champion Level 2

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.

sonya_m
SmartBear Alumni (Retired)

Thank you for advice Marsha!

 

Hi @tcarey ! Was this solved for you? Please share your progress🙂

If you still need help in this thread, please provide additional info as requested by Marsha.


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: