PC Review


Reply
Thread Tools Rate Thread

Click Excel custom menu item via MFC automation

 
 
Bo Zhu
Guest
Posts: n/a
 
      29th Apr 2010
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").Controls("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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Right Click Menu Item Mike McCollister Windows Vista General Discussion 1 13th Jun 2007 11:25 AM
Custom Menu item disappeared in Excel 2007 rjr1040 Microsoft Excel Programming 3 1st Apr 2007 03:29 AM
Custom event handling for click of menu item. trialproduct2004@yahoo.com Microsoft Dot NET 2 23rd Feb 2007 07:08 PM
Excel 2000 Custom Menu Item =?Utf-8?B?TGFycnkgQmlyZA==?= Microsoft Excel Misc 0 8th Nov 2005 08:25 PM
Persistent menu item with Excel Automation Add-in? srplatt@yahoo.com Microsoft Excel Programming 2 10th Jan 2005 05:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:29 AM.