Forum Discussion
sanjay0288
9 years agoFrequent Contributor
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}")