Excel Command Bar Controls

AlexD
04-06-2003, 09:59 AM
HI
the next code works to add a standar combobox in
my own toolbar

Dim CB As CommandBar
Dim CB_TEST As CommandBarComboBox

Set CB = Application.CommandBars.Add(Name:="MyToolBar", _
temporary:=False, Position:=msoBarTop)

Set CB_TEST = CB.Controls.Add(Type:=msoControlDropDown)

Yeah this works ok

But when i try to do the the same procedure to create a
Drop down button control like the fill color or font color at excel
i changed the type param to msoControlButtonDropdown
But doesnt work CB_TEST goes to NULL

The funny thing itīs that microsoft documentation explain that
a combobox type could be msoControlButtonDropdown, be dont
say that could be created as msoControlButtonDropdown in the Add method.
Type property is readonly so the only way to change it is at
Add method

can someone help me please
thanks

Mill
04-07-2003, 06:33 AM
That's odd. I did see what you're talking about in one section of the VBA help file, but I found this in the CommandBarControls Add method help:

Type Optional Variant. The type of control to be added to the specified command bar. Can be one of the following MsoControlType constants: msoControlButton, msoControlEdit, msoControlDropdown, msoControlComboBox, or msoControlPopup.


msoControlButtonDropdown isn't listed there. Strange.

jbo
04-07-2003, 07:23 AM
Alex,

As simple VBA Office programmers (like me) we can only create three types of controls: msoControlButton, msoControlDropdown, msoControlEdit
The other types are given to eventually access native controls but not for creation.
Yes, there's an extensive on-line documentation but, in my experienced opinion, reading it is a loss of time :( .

However, you may simulate functionnalities you're looking for.
For example by using a ControlDropDown with a hand made Popup bar.

Mill
04-07-2003, 07:36 AM
Alex,

As simple VBA Office programmers (like me) we can only create three types of controls: msoControlButton, msoControlDropdown, msoControlEdit
The other types are given to eventually access native controls but not for creation.
Yes, there's an extensive on-line documentation but, in my experienced opinion, reading it is a loss of time :( .

However, you may simulate functionnalities you're looking for.
For example by using a ControlDropDown with a hand made Popup bar.

You can use msoControlComboBox in a commandbar, but that's just a simple combobox, not a graphical one like Alex is wanting.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum