Rohit
Rohit

Reputation: 31

How can I get all Excel ribbons tab ids and labels?

I am working on an Excel add-in tool with a custom ribbon implementation. For this I need to find existing Excel ribbon tab ids and labels in Excel. How can I do this in C#?

Upvotes: 3

Views: 1152

Answers (1)

Phil.Wheeler
Phil.Wheeler

Reputation: 16858

You can use the Globals class to access the Ribbon:

foreach (Ribbon ribbon in Globals.Ribbons)
{
    // do something here
}

Refer: https://msdn.microsoft.com/en-us/library/bhczd18c.aspx

A ribbon inherits from a RibbonBase class, which doesn't have an ID property as part of the object model, but does use a Name or RibbonID property as unique attributes.

More at: https://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbonbase(v=vs.120).aspx

Upvotes: 1

Related Questions