If you are banging your head(which I quite frequently do) with GUI Automation of a Microsoft Office application, then this post is a must for you. QTP’s object Spy does not identify any of the Ribbon controls in any Office application. So, in order to click on any button in the ribbon, rather than relying on Sendkeys method, one can use the Command Bars Collection Object for accessing these buttons.
Here’s an example of how to use this in Microsoft Excel :-
The above code can be used for any Office application like PowerPoint,Word,Outlook etc. For more details on the Command Bars and Command Bar controls, you can visit the following links :-
PS: In UFT, all the ribbon controls are identified as WinButtons, so clicking on any Ribbon control is as easy as clicking on any button in a Web app.
Happy Automating !