ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msoControlActiveX (https://www.excelbanter.com/excel-programming/369978-msocontrolactivex.html)

willem

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;




All times are GMT +1. The time now is 02:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com