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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| Sub Supp_Cbar()
Dim Cbar As CommandBar
Application.CommandBars("Worksheet Menu Bar").Reset
For Each Cbar In CommandBars
If Cbar.BuiltIn = False Then Cbar.Delete
Next
End Sub
Sub Creation_Cbar()
Dim objPopUp 'As CommandBarPopup
Dim objBtn As CommandBarButton
Dim P(1 To 6)
Dim ccomb, ccomb1
Supp_Cbar
bandeau = Array(, "bandeau 1 ", "Bandeau 2 ", "bandeau 3 ")
popupB = Array(, "Outil texte", "Outil couleur", "outil 3")
With Application.CommandBars("Worksheet Menu Bar")
For i = 1 To 3
Set boutonband = .Controls.Add(Type:=msoControlButton, before:=i, temporary:=True)
With boutonband
.Caption = bandeau(i)
.FaceId = 226
.Style = msoButtonIconAndCaption
End With
Next
For e = 1 To 3
Set cpoptexte = .Controls.Add(Type:=msoControlPopup, before:=1, temporary:=True)
With cpoptexte
.Caption = "outils texte bande " & e
Set palette3 = .Controls.Add(Type:=msoControlGrid, ID:=1927, before:=1, temporary:=True)
Set P(1) = .Controls.Add(Type:=msoControlButton, ID:=113)
P(1).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "gras" & Chr(34) & "'"
Set P(2) = .Controls.Add(Type:=msoControlButton, ID:=114)
P(2).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "italic" & Chr(34) & "'"
Set P(3) = .Controls.Add(Type:=msoControlButton, ID:=115)
P(3).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "souligné" & Chr(34) & "'"
Set P(4) = .Controls.Add(Type:=msoControlButton, ID:=120)
P(4).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "aligne gauche" & Chr(34) & "'"
Set P(5) = .Controls.Add(Type:=msoControlButton, ID:=121)
P(5).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "aligne droite" & Chr(34) & "'"
Set P(6) = .Controls.Add(Type:=msoControlButton, ID:=122)
P(6).OnAction = "'action " & Chr(34) & e & Chr(34) & "," & Chr(34) & "aligne centrer" & Chr(34) & "'"
Set ccomb = .Controls.Add(Type:=msoControlComboBox, ID:=1728) '<-- combofont
Set ccomb2 = .Controls.Add(Type:=msoControlComboBox, ID:=1731) '<---combo font size
End With
Next
For a = 1 To 3
Set cpopcoul = .Controls.Add(Type:=msoControlPopup)
With cpopcoul
.Caption = "couleur texte " & a
Set palette3 = .Controls.Add(Type:=msoControlGrid, ID:=1927)
End With
Next a
End With
End Sub
Sub action(bande, acte)
MsgBox "operation " & acte & " sur le bandeau " & bande
End Sub |
Partager