Get RibbonUI from IRibbonControl? RRS feed

  • Question

  • Is there a way to get the RibbonUI from the control which is passes in the callback?


     Public Sub TemplateFolder_OnAction(ByVal control As Office.IRibbonControl, ByVal selectedId As String, ByVal selectedIndex As Integer)

    I want to Invalidate another control using <RibbonUI>.InvalidateControl("MyOtherControl"). The OnLoad event for the ribbon is only triggered once when you open a newmail window, but never for any consecutive opening of the newmailwindow.

    Also they say you could use Globals.Ribbons("MyRibbon"), but for some reason I don't have access to Globals.Ribbons, it just doesn't exist (I'm writing an Addin in VB.NET, based on an older version written by someonelse which is based on Outlook 2007).

    So I hoped I would be able to get the RibbonUI through the Control.Context somehow..

    Wednesday, July 3, 2013 12:14 PM


  • Hi SuperDre

    No, you can't get the RibbonUi from Ribbon controls, or anything else, once it's been loaded. It's only available in OnLoad.

    What you do is declare a class level variable for the RibbonUi and assign the object to it during OnLoad. Then you can use it at any time later on, through the class level variable.

    As to Globals.Ribbons... Are you sure this is a VSTO add-in and not a COM Add-in generated from the "Shared Add-in" template? From what you say about "based on an older version... which is based on Outlook" it sounds as if this is a COM Add-in and not a VSTO add-in.

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, July 3, 2013 1:37 PM