Bonjour tt le monde,
je cherche à créer un liste qui représente differentes macros dans une barre d'outils déjà créé. Ma barre d'outils actuelle me permet d'éxécuter tel macro définit comme un boutton de la barre et ce que je cherche mnt c'est de pouvoir classifier mes bouttons celon leur fonctionnalité. je vous mets ci-joint mon code afin que vous puissiez mieux comprendre:
Ce code permet la création d'une barre d'outils constituée de 5 bouttons: "vérification", "vérificationVraie", "Passif", "Actif" et "Compte résultat". Chaque boutton fait appel à une macro créée dans l'emplacement suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 Public 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:="MaBarrePerso", Position:=msoBarTop, Temporary:=False) Temporary:=False) 'Ajout des boutons dans la barre d'outils Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton) With Bouton .Style = msoButtonIconAndCaption '<-- bouton avec icône + texte .Caption = "Vérification" '<-- texte du bouton 'Définit "l'image" qui va s'afficher sur le bouton .FaceId = 3623 'Définit quelle macro est associée au bouton. 'Cette macro sera lancée à chaque fois que vous cliquez sur le bouton. .OnAction = "'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'!Comparer" End With Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton) With Bouton .Style = msoButtonIconAndCaption '<-- bouton avec icône + texte .Caption = "VérificationVraie" '<-- texte du bouton .FaceId = 3623 .OnAction = "'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'!Comparaison2" End With Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton) With Bouton .Style = msoButtonIconAndCaption .Caption = "Passif" .FaceId = 134 .OnAction = "'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'!Passif" End With Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton) With Bouton .Style = msoButtonIconAndCaption '<-- bouton avec icône + texte .Caption = "Actif" '<-- texte du bouton .FaceId = 2810 .OnAction = "'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'!Actif" End With Set Bouton = CmdBar.Controls.Add(Type:=msoControlButton) With Bouton .Style = msoButtonIconAndCaption '<-- bouton avec icône + texte .Caption = "Compte résultat" '<-- texte du bouton .FaceId = 2810 .OnAction = "'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'!CompteResultat" End With CmdBar.Visible = True End Sub Public Sub Workbook_BeforeClose(Cancel As Boolean) On Error Resume Next Application.CommandBars("MaBarrePerso").Delete End Sub
'C:\Documents and Settings\fadoua\Application Data\Microsoft\Macros complémentaires\macro.xla'
Ce que je souhaite obtenir est une barre d'outils avec deux boutton : "tests" et "remplissage" ou une fois qu'on clique sur tests par exemple une liste déroulante s'affiche me proposant soit "vérification" ou "vérificationVraie" et même chose pour "remplissage".
J'espère que j'étais assez claire et je vous remercie d'avance pour l'interet que vous allez donner à ma question.
Amicalement
Partager