1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Private Sub Workbook_Open()
Dim CmdBar As CommandBar
Dim Bouton As CommandBarButton
'Création de la barre d'outils nommée 'MaBarrePerso'
Set CmdBar = Application.CommandBars _
.Add(Name:="MaBarre", Position:=msoBarTop, Temporary:=True)
'Ajout de 3 boutons dans la barre d'outils
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
'.Name = bouton1
'Définit "l'image" qui va s'afficher sur le bouton
'.FaceId = 133 'CELA MARCHE AVEC DES ICONES PREDEFINIES
'Définit quelle macro est associée au bouton.
'Cette macro sera lancée à chaque fois que vous cliquez sur le bouton.
.OnAction = "Macro1"
End With
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.FaceId = 134
.OnAction = "Macro2"
End With
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.FaceId = 135
.OnAction = "Macro3"
End With
CmdBar.Visible = True
End Sub |
Partager