cancel
Showing results for 
Search instead for 
Did you mean: 

Right Click on a cell in excel and perform Operation from List

Highlighted
Occasional Contributor

Right Click on a cell in excel and perform Operation from List

Hi,

          I have got object of excel which is already opened and selected required sheet, and have selected cell. Now how can select a cell and Right click on that particular cell to perform certain operation from testcomplete ?

 

This is my code.

Set Excel = GetObject("Excel Name")
Set objSheet = Excel.Worksheets("Sheet Name")
BuiltIn.Delay 1250
Set objRange = objSheet.Range("K5")
objRange.Select

 

Please help me to right click on a cell. I used Sys.Keys(![f10] but keyboard input will not get parameters i want, only mouse click will help me

 

regards,

Nethra

3 REPLIES 3
Frequent Contributor

Re: Right Click on a cell in excel and perform Operation from List

Highlighted
Occasional Contributor

Re: Right Click on a cell in excel and perform Operation from List

Yes, i have tried with ClickR but that is not working. 

Highlighted
Frequent Contributor

Re: Right Click on a cell in excel and perform Operation from List

Hi, You need to activate the excel sheet before sending the keys. or please find the vb script which performs the right click operation. I have written a vbscript and tested on the excel and it is working fine.

 

'Create an instance of excel application and open workbook

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.open("C:\Users\\Desktop\Book1.xlsx")


Set objSheet = objExcel.Worksheets("Sheet1")
objExcel.Visible = True
Set objRange = objSheet.Range("K5")
objRange.Select

 

'Create an instance to the windows script host
Set WshShell = WScript.CreateObject("WScript.Shell")

 

'Activate the excel
WshShell.AppActivate "Microsoft Excel"
WScript.Sleep(5000)
WshShell.SendKeys ("+{F10}")

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors