Private tlbMyToolbar As CommandBar
'Add tool bar
Sub AddToolbar()
Dim tlbMyButton As CommandBarButton
Set tlbMyToolbar = Application.CommandBars.Add( _
name:=" Example Toolbar", _
Position:=msoBarFloating, _
Temporary:=True)
tlbMyToolbar.Visible = True
Set tlbMyButton = tlbMyToolbar.Controls.Add( _
Type:=msoControlButton, _
Temporary:=True)
tlbMyButton.Style = msoButtonIconAndCaption
tlbMyButton.Picture = LoadPicture(ActiveWorkbook.Path & "\myImage.bmp")
tlbMyButton.Caption = "Test"
End Sub
|