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
|