Noam Gal
Noam Gal

Reputation: 3405

Customize Office Ribbon programmatically

I am writing an addin to Office (both 2007 and 2010), and have so far used the Fluent Ribbon XML to customize the different ribbons.
The problem I am having now with that approach, is that I want to have a bit more flexibility in my code, and have different modules add more buttons to the ribbon, without hard coding them in XML - The addin is composed of several disconnected modules, and it doesn't "know" exactly what ribbon elements it might need.

Is there a way to do it? I bumped into the LoadCustomUI method on the Application object, but it is not available in C#. Looks like just what I might have used for my scenario.

Upvotes: 3

Views: 8139

Answers (1)

Todd Main
Todd Main

Reputation: 29155

For .NET 4 (which I assume you're using because of targetting Office 2010), you'll override CreateRibbonExtensibilityObject. More info can be found on this page: Ribbon Object Model. This is also a good read: Updating the Controls on a Ribbon at Run Time.

Upvotes: 2

Related Questions