Handling Events of an IRibbonControl object RRS feed

  • Question

  • Is it possible to handle events from a customUI control?  I cannot see any available when developing in either VBA or Visual Studio, so am presuming that none are available to hook into.

    I'm specifically looking to handle the event that appears to fire when one's mouse has hovered over a control on, say the Word ribbon.  after about a second a box appears with the function name, the short cut key combination and the screentip.  this happens without clicking so the ribbon control must know that the mouse is over the control, and therefore surely there is a MouseOver event that is fired.

    Is this event only available internally to Word itself, or have i missed this in the object model.

    Are any events available to handle on customUI controls?

    Monday, February 4, 2013 4:24 PM


All replies

  • Hi Matt Cope,

    Thank you for posting in the MSDN Forum.

    I think you don't need handle that yourself. When you move your mouse over a ribbon control, its info will shown automatically.

    Hope it helps.

    Best regards, 

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 5, 2013 7:39 AM
  • Thanks

    i think i didn't make myself clear in my first place.  i dont actually want to display the box that i previously mentioned (as this is already being displayed).  What i want to do is be able to add controls that behave in the same way as the inbuilt office ones, so that i can capture the events and execute some custom code.

    For example, i may have a control that inserts BuildingBlock or AutoText Entry.  This counrol could ba a list of items either a gallery or a dropdown.  i want to be able to create a function that will insert the selected BB/ATE without the user clicking the item that the mouse is currently on, and then remove the BB/ATE.  This would provide a preview insertion tool, which would work in exactly the same way that the inbuilt Word QuickStyles gallery works.

    Currently, as far as i can see, the only event that can be handled is the onAction event (although technically the object model names this as an attribute), and this is the event to handle if the user clics on a ribbon control.  Are there, or will there be, other events to handle, such as MouseOver, MouseRightClickDown etc?

    I hope that has given more of an explaination as to my requirements.

    Tuesday, February 5, 2013 11:29 AM
  • HI Matt

    There are currently no MouseOver or similar events for Ribbon controls. As far as I know, there's only the Accessibility APIs that can provide additional "functionality":

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, February 6, 2013 8:40 AM
  • David Parker did a tutorial that focused on Visio, but the process should apply to most of the office products


    If this answer solves your problem, please check Mark as Answered. If this answer helps, please click the Vote as Helpful button. Al Edlund Visio MVP

    Wednesday, February 6, 2013 1:04 PM
  • thanks cindy

    i shall investigate those links and see where they lead me.

    it might turn out that the time/cost factor outweighs the demand, especialy if i have to get too dirty.

    dont suppose you know if the situation is likely to change in the near future at all?  it seems a little lacking of the ribbon to only offer one real event to be able to handle... onAction.  only today i was needing to be able to hook into a dropdown list and only populate the contents at the point that the user actually clicks on the control (as the list item labels include a relative time indicator which can only be calculated at the point that the control is clicked, and not when an item is actually selected).  currently this cannot be done (well, simply at least)



    Wednesday, February 6, 2013 2:35 PM
  • Hi Matt

    <<dont suppose you know if the situation is likely to change in the near future at all?>>

    Depends on your definition of "near future" :-), but certainly not in the next two or three years (before the next Office version is released). No idea if it will change then, but it won't change before that.

    No idea if the Windows API can help you at all...

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, February 6, 2013 3:23 PM
  • hehe... yes very ambiguous is "near future".  open to very wide interpretation

    I shall raise this somewhere at 

    and one day (in the not so near future) i might appear in one of their adds saying "that was my idea". hehe

    cheers cindy

    Thursday, February 7, 2013 2:06 PM
  • errr... maybe even "not so near future", but perhaps "in a portal far, far away".  connect appears not to have a suggestion box for Office!?

    maybe i need to suggest that they need a suggestion portal first?

    failing that cindy, do you know where the place for me to lodge requests for office is?  or is there simply not that availability?

    Thursday, February 7, 2013 2:12 PM
  • There is no availability, I'm afraid, unless you're in some kind of "partner" program :-(

    Something I've done, on occasion, is to use the "Community Feedback" for Help topics. For example, go to a Help topic that's as closely related as you can find (onAction) and, at the bottom, where it asks you if the topic helped you, click "No" and then type in the reason: that you require more events, such as XYZ. And give the business reasons for needing them.

    These things do get read and, if they're non-emotion/non-rant do flow into some kind of internal process.

    Or you open a paid support incident saying you absolutely need this.

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, February 7, 2013 4:51 PM