none
How to get a reference to a ribbonx object from ThisAddin? RRS feed

  • Question

  • Working in vs2010 vb and Word 2010.

    In my Word Addin, I have recently converted a designer type ribbon to Ribbonx.
    When it was a designer type, I used:
    Dim ProcRib As ProcedureAddIn.ProcRibbon =
      Globals.Ribbons.GetRibbon(Of ProcRibbon)()


    Tim

    Thursday, March 29, 2012 5:02 PM

Answers

  • Forrest,

    Thanks for the reply.

    This is what I ended up with:
    Ribbon1 is the XML Ribbon and
    ProcRib is declared as Friend in a Module (Setup.vb)
    Setup.ProcRib can now be accessed thruout my project.

    In ThisAddIn.vb
    Protected Overrides Function CreateRibbonExtensibilityObject() As Microsoft.Office.Core.IRibbonExtensibility
      Setup.ProcRib = New Ribbon1
      Return Setup.ProcRib
    End Function

    In Setup Module:
    Friend ProcRib As Ribbon1

    Thanks Again

    Tim

    • Marked as answer by Tim_Shaf Monday, April 2, 2012 11:48 AM
    Monday, April 2, 2012 11:48 AM

All replies

  • Hi Tim,

    Thank you for posting.

    I will help you involve others to help you. There might be some delay about the response. Appreciate your patience.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    Friday, March 30, 2012 7:30 AM
  • Hi, Tim

    How about following code:

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
    
                Microsoft.Office.Core.IRibbonExtensibility ribbon1 = this.CreateRibbonExtensibilityObject();
                
               
            }
    
            protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
            {
                return new Ribbon1();
            }

    Ribbon1 is the class generated by Ribbon XML item.

    Hope this could get you on right direction.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, March 30, 2012 4:53 PM
    Moderator
  • Forrest,

    Thanks for the reply.

    This is what I ended up with:
    Ribbon1 is the XML Ribbon and
    ProcRib is declared as Friend in a Module (Setup.vb)
    Setup.ProcRib can now be accessed thruout my project.

    In ThisAddIn.vb
    Protected Overrides Function CreateRibbonExtensibilityObject() As Microsoft.Office.Core.IRibbonExtensibility
      Setup.ProcRib = New Ribbon1
      Return Setup.ProcRib
    End Function

    In Setup Module:
    Friend ProcRib As Ribbon1

    Thanks Again

    Tim

    • Marked as answer by Tim_Shaf Monday, April 2, 2012 11:48 AM
    Monday, April 2, 2012 11:48 AM
  • Great. Nice to know that.

    regards,


    Forrest Guo | MSDN Community Support | Feedback to manager

    Monday, April 2, 2012 1:08 PM
    Moderator