Option Explicit
Option Base 1
'
Private Const Nom_barre_outils = "Utilitaire"
'
Private Sub Workbook_Open()
Ouverture_CommadeBar
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Fermeture_Commandebar
End Sub
Private Sub Ouverture_CommadeBar()
Dim CmdBar As CommandBar
Dim Bouton As CommandBarButton
'Création de la barre d'outils nommée 'MaBarrePerso'
Set CmdBar = Application.CommandBars.Add(Name:=Nom_barre_outils, Position:=msoBarTop, Temporary:=True)
'Ajout des boutons dans la barre d'outils
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.Caption = "Mettre en forme le nom des sites"
.FaceId = 439
.OnAction = "Coloration_site"
End With
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.Caption = "Mettre en forme le reste du calendrier"
.FaceId = 8
.OnAction = "Re_Mise_Forme_Conditionnelle"
End With
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.Caption = "Transfert du calendrier vers le listing"
.FaceId = 132
.OnAction = "transfert_planning_vers_liste"
End With
Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton)
With Bouton
.Caption = "Transfert du listing vers le calendrier"
.FaceId = 133
.OnAction = "transfert_liste_vers_planning"
End With
CmdBar.Visible = True
End Sub
Private Sub Fermeture_Commandebar()
On Error Resume Next
Application.CommandBars(Nom_barre_outils).Delete
End Sub