4

I have used products to write ribbons for Excel in C# (addin express) but I need to know how to produce a ribbon using vba. Would someone be able to provide me with some code that inserts an additional ribbon into the toolbar for this?

By ribbon I mean where it says "Formulas", "Data", "Review" etc

Olle Sjögren
  • 5,315
  • 3
  • 31
  • 51
intrigued_66
  • 16,082
  • 51
  • 118
  • 189
  • 1
    Have you seen this.. (http://stackoverflow.com/questions/10992205/write-excel-addin-with-vba-and-then-put-a-button-that-trigger-it) – Dave Lewis Oct 29 '12 at 16:48
  • 4
    Check out Ron De Bruin's page on the ribbon. It will help you understand what you're dealing with: http://www.rondebruin.nl/ribbon.htm. – nutsch Oct 29 '12 at 16:49
  • Yes, use the rondebruin-link. In short, you save XML in the excel file to describe how the ribbon will look and then add VBA code to provide actions for when the ribbon controls are used. If you run into a specific problem, post it here and I'm sure you will get help. – Olle Sjögren Oct 29 '12 at 17:34

2 Answers2

4

You can customize the ribbon in Excel using a combination of XML and VBA.

A good starting-point for customizing the ribbon: http://msdn.microsoft.com/en-us/library/office/aa338202%28v=office.12%29.aspx (The title says Office 2007 but it will work for Office 2010 as well)

Another good source is the one nutsch mentioned in his comment.

There is also a free application that helps you design and validate the XML to modify the ribbon called the "Custom UI Editor For Microsoft Office": http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2006/05/25/customuieditor.aspx

Alfabravo
  • 7,493
  • 6
  • 46
  • 82
Olle Sjögren
  • 5,315
  • 3
  • 31
  • 51
0

There is a simple trick to it - the xml is to be included in your .xlsm file.

See this link How to add a custom Ribbon tab using VBA?

Community
  • 1
  • 1
Jan Wijninckx
  • 501
  • 6
  • 8