Recording the excel sheet macros using QTP
I 'm trying to record the excel sheet using QTP. I have an excel sheet which contains macros. It contains images in the excel sheet which I need to click on it so that it will open another sheet which is embedded in the same excel sheet. How can I record the action of clicking on the images in the excel sheet. When I spy with the QTP tool it is taking as WINOBJECT. And I tried recording it is captured as winobjects and captured the x,y co ordinates. How can I achieve this with capturing the co ordinates. In my web application it is captured as buttons, link, edit boxes. Is there any mechanism to capture without as win object.
Let me know how to record the excel macros using QTP
Thanks for your replies.
MS Office products should be accessed through the Office Object Model. QTP is not able to interface with it properly.
vba - Run Excel Macro from Outside Excel Using VBScript From Command Line - Stack Overflow
One of the way to accomplish this function is create a macro to click on the image in the excel and run the macro using QTP.
Eg. excelObj.run "Samplemacro"
It would be interesting to check this method. It looks good though.
I need to click on a particular text using Gettext location method. I have written the below code to capture the co ordinates and passing the co ordinates to perform click operation .
l = -1
t = -1
r = -1
b = -1
text=Window("Live Dashboard").WinObject("Live Dashboard").GetTextLocation("Buying",l,t,r,b)
a = (x1+x2) / 2
b = (y1+y2) / 2
Window("Live Dashboard").WinObject("Live Dashboard").DblClick a,b,micLeftBtn
But it is not giving the location co ordinates of the text which I 'm finding. Attaching the image of the excel file which I would like to perform the click operation.
Please do let me know if you require any further information.
Last edited by vamshidhara; 04-01-2014 at 04:12 AM.
As rightly pointed out by NU4aN QTP does not support GUI interactions with MS Office applications, you should follow his link and look to use the API which will give you what you need.
Looking at your application even if you did manage to click one of the icons you will have a similar problem which the next workbook/sheet/form. Looks like you have already spent a bit of time on this and got nowhere, IMHO continuing down the route you are currently taking will lead to a lot of lost time with no results.