Salut le forum

J'ai une difficulté pour pour obtenir le résultat souhaité dans l'appel de 3 macros.
En effet, dans un usf j'ai un bouton qui permet d'exécuter les codes ci-dessous:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
Call Label12_Click 'remplissage de la feuille fiche_opportunite
Call Label13_Click 'remplissage de la feuille RECAP_OPPORTUNITE
Call Label11_Click 'remplissage de la feuille PARAMETRE
A l'exécution, aucun résultat dans l'appel de ce code Je ne sais pas pourquoi.
Ci-dessous les différents codes intégral pour appréciation:
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
Private Sub Label11_Click()
Dim strsQL As String
Dim Rs
OpenConnexion Fichier
Sql = "select * from  [" & Feuille14 & "] where [NUM_PROJET]='" & Trim(TextBox1.Value) & "';"
Set Rs = CreateObject("adodb.recordset")
Rs.Open Sql, Cnx
If Rs.EOF = False Then
MsgBox "Existe"
Else
strsQL = "insert into [" & Feuille14 & "] ([NUM_PROJET]) "
        strsQL = strsQL & "Values ('" & Trim(TextBox1.Value) & "');"
Cnx.Execute strsQL
'Set Cnx = Nothing
End If
Rs.Close
Set Rs = Nothing
Cnx.Close
Set Cnx = Nothing
Unload Me
 
End Sub
Private Sub Label12_Click()
Dim Ctl As Control
Dim Col As Integer, lig As Integer
 
Col = 5 'pour la colonne C
With Sheets("FICHE_OPPORTUNITE")
For Each Ctl In Me.Controls
If TypeOf Ctl Is MSForms.TextBox Then
If Ctl.Tag <> "" And Ctl <> "" Then
lig = Ctl.Tag
.Cells(lig, Col).Value = Ctl.Text
End If
ElseIf TypeOf Ctl Is MSForms.ComboBox Then
lig = Ctl.Tag
.Cells(lig, Col).Value = Ctl.Text
 
End If
Next Ctl
End With
End Sub
Private Sub Label13_Click()
Dim strsQL As String
Dim Rs
OpenConnexion Fichier
 
Sql = "select * from  [" & Feuille & "] where [NUM_PROJET]='" & Trim(TextBox1.Value) & "';"
Set Rs = CreateObject("adodb.recordset")
Rs.Open Sql, Cnx
If Rs.EOF = False Then
MsgBox "Existe"
Else
strsQL = "insert into [" & Feuille & "] ([NUM_PROJET],[TYPE_DE_PROJET],[CHEF_DE_PROJET],[SOUS-TRAITANT],[CONSULTANT],[OBJET],[CLIENTS],[LIEU_DE_DEPOT],[DATE_DE_DEPOT],[HEURE_DEPOT]) "
        strsQL = strsQL & "Values ('" & Trim(TextBox1.Value) & "','" & Trim(ComboBox1.Value) & "','" & Trim(ComboBox2.Value) & _
       "','" & Trim(ComboBox3.Value) & "','" & Trim(ComboBox4.Value) & "','" & Trim(TextBox2.Value) & "','" & Trim(ComboBox5.Value) & "','" & Trim(TextBox3.Value) & "','" & Trim(TextBox4.Value) & _
       "','" & Trim(TextBox5.Value) & "');"
Cnx.Execute strsQL
'Set Cnx = Nothing
End If
Rs.Close
Set Rs = Nothing
Cnx.Close
Set Cnx = Nothing
Unload Me
End Sub