Salut à tous
N'ayant pas de solutions avec la partie de ma macro qui permet de pouvoir interrompre le fonctionnement de la macro.
J'ai décidé de les "supprimer" (mis comme commentaire) afin de pas mettre en cause les autres fonctionalités.
un débogage apparait avec ce message Next sans For. j'ai supprimé le Next souligné et quand je tente de vérifier encore le code, le débogage signale variable de controle For déjà utilisée.
Pouvez-vous me donner un coup de main?
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 
Sub activesimple()
Dim I As Integer, MemJ8 As Integer
'On Error GoTo gestionerreur
If MsgBox("Avant de confirmer la saisie automatique, assurez-vous que :" & Chr(10) & Chr(10) & "- Les observations du client issues de la vérification des informations ont été prises en compte," & Chr(10) & "- Vous êtes bien positionné sur le menu ouverture simplifié - Nouveau client,", vbYesNo, "Demande de confirmation") = vbYes Then
'noaction = False
AppActivate "LOGICIEL"
attendre 1
 
'POSITIONNEZ-VOUS SUR LE MENU SIMPLIFIE IGOR SOUHAITE
For I = 3 To 45
' Si I = 8 alor on mémorise la valeur de la cellule
If I = 8 Then MemJ8 = Range("J8").Value
' Si I = 16 ou 17
If I = 17 Or I = 18 Then
' Si la veleur mémorisée est 3
If MemJ8 = 3 Then
' On inscrit le nom et le prénom du mari
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
'End If
'Else
' Si I à une autre valeur que 16 ou 17
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
'End If
SendKeys "+{F3}"
attendre 1
'If noaction Then Exit Sub
Next
For I = 46 To 53
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
Next
SendKeys "+{F6}"
attendre 1
'If noaction Then Exit Sub
 
For I = 54 To 54
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
Next
 
Exit Sub
gestionerreur:
MsgBox "fichier non ouvert ou réduit dans la barre des tâches : abandon"
End If
End Sub
 
Sub activePack()
Dim I As Integer, MemJ8 As Integer
Var = 0
'On Error GoTo gestionerreur
If MsgBox("Avant de confirmer la saisie automatique, assurez-vous que :" & Chr(10) & Chr(10) & "- Les observations du client issues de la vérification des informations ont été prises en compte," & Chr(10) & "- Vous êtes bien positionné sur le menu ouverture simplifié - Nouveau Client Pack ... .", vbYesNo, "Demande de confirmation") = vbYes Then
'noaction = False
AppActivate "LOGICIEL"
attendre 1
 
'POSITIONNEZ-VOUS SUR LE MENU SIMPLIFIE IGOR SOUHAITE
For I = 3 To 6
    SendKeys Cells(I, 10).Value, True
    attendre 0.6
    'If noaction Then Exit Sub
    SendKeys "~"
    attendre 1
    'If noaction Then Exit Sub
Next
    SendKeys "N" & Chr(13), True
    attendre 0.6
    'If noaction Then Exit Sub
    SendKeys "{LEFT}"
    SendKeys "{ENTER}"
    attendre 1
    'If noaction Then Exit Sub
 
For I = 7 To 45
 
'POSITIONNEZ-VOUS SUR LE MENU SIMPLIFIE IGOR SOUHAITE
'For I = 3 To 45
' Si I = 8 alor on mémorise la valeur de la cellule
If I = 8 Then MemJ8 = Range("J8").Value
' Si I = 17 ou 18
' si I = 7
 
If I = 17 Or I = 18 Then
' Si la veleur mémorisée est 3
If MemJ8 = 3 Then
 
' On inscrit le nom et le prénom du mari
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
'End If
'Else
' Si I à une autre valeur que 16 ou 17
SendKeys Cells(I, 10).Value, True
attendre 0.6
'If noaction Then Exit Sub
SendKeys "~"
attendre 1
'If noaction Then Exit Sub
'End If
Next
    SendKeys "+{F3}"
    attendre 1
    'If noaction Then Exit Sub
For I = 46 To 53
    SendKeys Cells(I, 10).Value, True
    attendre 0.6
    'If noaction Then Exit Sub
    SendKeys "~"
    attendre 1
    'If noaction Then Exit Sub
 
Next
    SendKeys "+{F6}"
    attendre 1
    'If noaction Then Exit Sub
 
For I = 54 To 54
    SendKeys Cells(I, 10).Value, True
    attendre 0.6
    SendKeys "~"
    attendre 1
Next
Exit Sub
gestionerreur:
MsgBox "fichier non ouvert ou réduit dans la barre des tâches : abandon"
End If
End Sub
 
Sub attendre(sec%)
Dim deb&, fin&
deb = Timer
fin = deb + sec%
Do Until Timer >= fin
DoEvents
''Var = GetKeyState(27)
'If Var > 0 Then
'If MsgBox("Confirmation arrêt macro", vbOKCancel) Then
'SendKeys Chr(27)
'noaction = True
'noaction = False
'Var = 0
Exit Do
'End If
'End If
Loop
End Sub