View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
willem willem is offline
external usenet poster
 
Posts: 2
Default msoControlActiveX

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.Ad d(Microsoft.Office.Core.MsoControlType.msoControlA ctiveX,
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;