msoControlActiveX

W

willem

I am writing an add-in for excel that should a buttons to a commandBar.
Since Excel doesn't allow me to add a msoControlButtonDropdown, I have tried
going the ActiveX control route(msoControlActiveX).

However, when I add my activeX control to the commandBar the size is totally
wrong, and I can't resize it. Any ideas?

I am using Office 2003. Here's the code that adds the control to the
"standard" commandBar:

object omissing = System.Reflection.Missing.Value;
MyButton =
(Office.CommandBarControl)oStandardBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlActiveX,
omissing, omissing, omissing, omissing);
MyButton.Caption = "My Custom Button5";
Microsoft.Office.Core._CommandBarActiveX activeXControl = MyButton as
Microsoft.Office.Core._CommandBarActiveX;
activeXControl.ControlCLSID = "{830C63B8-6C8A-4b64-99F2-237319703D8F}";

MyButton.Width = 32;
MyButton.Height = 32;
 

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