How do I Modify “Toolbar Options†using C#?

K

Kim Greenlee

I’m building an Excel Add-In using C#. I create a new toolbar:

mToolBar = (CommandBar) mApplicationObject.CommandBars.Add(
strProductLabel, MsoBarPosition.msoBarTop, Missing.Value, true);
mToolBar.Visible = true;
mToolBar.Enabled = true;

Then I add some buttons....

All the CommandBar objects seem to have a wrapper around them that owns a
menu object (a little down arrow) with the tool tip text: “Toolbar Optionsâ€.
When I select the arrow the menu item “Add or Remove Buttons†is displayed.
I select the little arrow on that menu item and I get a menu containing two
items. The first item is the value of strProductLabel, the second item is
“Customize...â€

The menu item with the label strProductLabel is grayed out. Is there some
setting to automatically set this up enabled? I’ve looked at trying to put
menu items into it but....I have no idea how to get access to it.

I’ve looked at trying to access the mToolBar.Parent object but I can’t find
any references to it and its type is object. If someone could tell me how
the “Toolbar Options†menu works, point me to a reference, and/or provide
some code I would be very grateful.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top