Add Method (CommandBars Collection) Example

This example adds a top-level command bar named "Custom”. The example also adds a built-in paste button to the command bar.

Set mybar = CommandBars _
    .Add(Name:="Custom", Position:=msoBarTop, _
    Temporary:=True)
With mybar
    .Controls.Add Type:=msoControlButton, Id:= _
        CommandBars("Edit").Controls("Paste").ID
    .Visible = True
End With