Style Property Example

This example creates a shortcut menu containing a button control and a combo box control and sets the style of each.

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