macro bouton active x

mimi1958

XLDnaute Junior
voila j'ai fait ce code mais en plus je voudrais qu"il execute une macro que j'ai creer
comment rajouter ma macro a ce code

Private Sub CommandButton1_Click()
If CommandButton1.BackColor = &HFF00& Then
CommandButton1.BackColor = &HC0C0C0
Else
CommandButton1.BackColor = &HFF00&
End If
End Sub
merci par avance
 

DoubleZero

XLDnaute Barbatruc
Bonjour à toutes et à tous,

Zéro_O "Bonjour", mimi1958 ?

Comme ceci ?
VB:
Option Explicit
Private Sub CommandButton1_Click()
    If CommandButton1.BackColor = &HFF00& Then
        CommandButton1.BackColor = &HC0C0C0
        Call macro1
    Else
        CommandButton1.BackColor = &HFF00&
        Call macro2
        ' ou
        ' exit sub
    End If
End Sub
Sub macro1()
    MsgBox "Bonjour !"
End Sub
Sub macro2()
    MsgBox "A bientôt..."
End Sub
A bientôt :)
 

Discussions similaires

Réponses
16
Affichages
503
Réponses
6
Affichages
212

Statistiques des forums

Discussions
312 329
Messages
2 087 331
Membres
103 519
dernier inscrit
Thomas_grc11