View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default Adding Controls in a toolbar?

This will add a new control to the worksheet menu bar:

Sub NewControl()

Dim cmd As CommandBarButton

Set cmd = Application.CommandBars("Worksheet Menu Bar"). _
Controls.Add

With cmd
.BeginGroup = True
.Caption = "My New &Button"
.Style = msoButtonCaption
.BeginGroup = True
.OnAction = "Insert Macro Name Here"
End With

OnExit:

Set cmd = Nothing

End Sub

--
Kevin Backmann


"joe" wrote:

How can I add controls to a toolbar, using VBA code?