Export a Ribbon from the Ribbon Designer to Ribbon XML VS 2015

Export a Ribbon from the Ribbon Designer to Ribbon XML VS 2015

Ribbon Designer to Ribbon XML

If your are stucked as you have already built VSTO application by using Ribbon designer but as mentioned in previous topics, Ribbon designer is not capable enough to cop-up all your ribbon customization needs like creating Menu Buttons, Context Menus etc. And you are end up with empty hand seeking help. Now you have no choice than creating entire ribbon design from scratch using Ribbon XML. No worries here is the solution to grab your existing ribbon design into XML which you can take for your next level development.


  • Visual studio 2010 or above
  • A Office Adding Project (Visual Studio Tools for Office)

To export a Ribbon from the Ribbon Designer to Ribbon XML

  1. Right-click the Ribbon code file in Solution Explorer, and then click View Designer.
  2. Right-click the Ribbon Designer, and then click Export Ribbon to XML.
    • Visual Studio adds a Ribbon XML file and a Ribbon XML code file to your project.
  3. In the Ribbon code class, locate the comments that start with TODO:.
  4. Copy the code block in these comments to the ThisAddin, ThisWorkbook, or ThisDocument class, depending on which type of solution you are developing.
    • This code enables the Microsoft Office application to discover and load your custom Ribbon. For more information, see Ribbon XML.
  5. In the ThisAddin, ThisWorkbook, or ThisDocument class, un-comment the code block.

After you un-comment the code, it should resemble the following example. In this example, the Ribbon class is called MyRibbon.

Code example:

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
	return new MyRibbon();
  • Switch to the Ribbon XML code file and find the Ribbon Callbacks region.
  • This is where you write callback methods to handle user actions, such as clicking a button.
  • Create a callback method for each event handler that you wrote in the Ribbon Designer code.
  • Move all your event handler code from the event handlers to the callback methods, and modify the code to work with the Ribbon extensibility (RibbonX) programming model.

Next>>Accessing the Ribbon at Run Time

Leave a Reply

Your email address will not be published. Required fields are marked *