目录

Controls 属性

优质
小牛编辑
114浏览
2023-12-01

返回这样一个CommandBarControls 对象,该对象代表指定命令栏或弹出式控件中的所有控件。只读。

有关返回单个集合成员的详细信息,请参阅返回集合中的对象

示例

本示例可实现的功能为:在命令栏“Custom”中添加一个组合框控件,然后在该组合框列表中添加两个项目。本示例同时设置列表的行数,组合框的宽度,并将该组合框的默认值设置为空。

Set myControl = CommandBars("Custom").Controls _
 .Add(Type:=msoControlComboBox, Before:=1)
With myControl
 .AddItem Text:="First Item", Index:=1
 .AddItem Text:="Second Item", Index:=2
 .DropDownLines = 3
 .DropDownWidth = 75
 .ListHeaderCount = 0
End With