BVon...
Perfectionne maintenant la chose...
Regarde ce que fait ceci (un nouveau projet avec un UserForm, un bouton de commande et un label...) ==>> tu vas voir ce qui se passe, mais il va te falloir ensuite analyser ce mécanisme de gymnastique (amuse-toi bien) ===>> et en profiter
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 Private toto As Boolean Private Sub CommandButton1_Click() MsgBox toto & "a" toto = Not toto coucou Dim i As Long, a As Long If toto Then For i = 1 To 10000000 'n'importe quoi qui va prendre du temps, padi (essai) If Not toto Then Exit Sub a = i * 10 a = a / 2 a = a / 5 Label1.Caption = i DoEvents Next End If End Sub Private Sub UserForm_Click() toto = Not toto coucou End Sub Private Sub UserForm_Initialize() coucou End Sub Private Sub coucou() CommandButton1.Caption = IIf(toto, "arrêter", "démarrer") End Sub
Partager