ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Click Excel custom menu item via MFC automation (https://www.excelbanter.com/excel-programming/442147-click-excel-custom-menu-item-via-mfc-automation.html)

Bo Zhu

Click Excel custom menu item via MFC automation
 
Hi,

I have a question regarding custom Excel 2003 menu item click via MFC
automation.

The VBA version of the action I want to do is pretty straightforward:
Application.CommandBars(1).Controls("NumeriX").Con trols("Object
Tools").Controls("Delete All Objects").Execute

Now I need to translate the above line to C++ code. I already have the
automation classes for CCommandBars, CCommandBar0, CCommandBarControls,
CCommandBarControl classes generated by VS.NET 2003 class wizard.

The interesting thing is that the get_Item() method of CCommandBarControls
class returns a CCommandBarControl object, while in the VBA version another
CCommandBarControls object should be returned as the menu contains sub-menus.
Also I'm not so clear about the item index usage. From my preliminary
testing, the number returned by get_Count() method of CCommandBarControls
class is not equal to the number of visable menus on Excel menu bar.

Hope someone can clarify my doubt. Thanks!

Best regards,

Bo ZHU


All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com