全部显示

Style 属性

       

Style 属性应用于 CommandBarButton 对象时的情形。 

Style 属性应用于 CommandBarComboBox 对象时的情形。

示例

本示例可实现的功能为:创建一个快捷菜单,该菜单包含一个按钮控件和一个组合框控件,并分别设置两者的样式。

Set myBar = CommandBars _
    .Add(Name:="Custom1", Position:=msoBarPopup, Temporary:=False)
With myBar
    .Controls.Add Type:=msoControlButton, Id:=3
    .Controls(1).Style = msoButtonCaption
    .Controls.Add Type:=msoControlComboBox
    With .Controls(2)
        .Style = msoComboLabel
        .AddItem "vanilla"
        .AddItem "chocolate"
        .AddItem "cookie dough"
    End With
End With
myBar.ShowPopup