View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Creating a CommandBar - what's wrong?

Try fully qualifying the CommandBars property. I suggest
making the tool bar Temporary to avoid having to delete
them. I havn't found a problem with this. Correct for
word wrap:-

Private Sub CreateCommandBar()
Dim TBar As CommandBar
Set TBar = Application.CommandBars.Add(Temporary:=True)
With TBar
..Name = "OPLToolBar"
..Top = 0
..Left = 0
..Visible = True
End With

Set NewBtn1 = Application.CommandBars
("OPLToolBar").Controls.Add _
(Type:=msoControlButton)
With NewBtn1
..FaceId = 481
..OnAction = "Sort"
..Caption = "Main Sort"
..Style = msoButtonIconAndCaption
End With

End Sub