Bonjour,

J'ai lu cette discussion.

J'ai le même soucis, peut-être pourriez-vous m'aider.

Voici mon premier code qui fonctionne en boucle mais seulement pour la première valeur de cellule de ma plage
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
Sub boucle()
 
 
   For Each Cell In Sheets("Extraction").Range("C4:C107")
        If Cell.Value <> 0 Then
        Call Sub_PDF_All
 
        End If
 
   Next Cell
 
End Sub

Voici le code modifié suite à votre discussion :
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
Sub boucle()
 
   For Each Cell In Sheets("Extraction").Range("C4:C107")
            Sub_PDF_All CStr(Cell(1, 1).Value)
 
   Next Cell
 
End Sub
 
Sub Sub_PDF_All()
 
 autECLSession.autECLPS.SendKeys Sheets("Extraction").Range("C4:C107")
 
Dim NbCopy As Integer
Dim debut As Integer
Dim fin As Integer
Dim TamponProp As Boolean
Dim PDFFileName As String
Dim myPath As String
 
myPath = ThisWorkbook.Path
 
Application.ScreenUpdating = False
 
        Sheets("Base des paramètres").Select
        Sheets("Base des paramètres").Range(Cells(5, 2 + i), Cells(299, 2 + i)).Copy
                Sheets("Extraction").Range("E1").PasteSpecial _
                   Paste:=xlPasteValues
 
 
              PDFFileName = myPath & "\" & Sheets("Extraction").Range("E23").Value & " - " & Sheets("Extraction").Range("E3")
 
            If shtExtraction.Range("E187").Value = 12 And shtExtraction.Range("E19").Value = "CE" Then
               Sheets(Array("Fiche 0", "Fiche 2", "Fiche 3", "Fiche 4", "Fiche 5", "Fiche 6", "Eval 1", "12 ans")).Select
 
            Else
 
            If shtExtraction.Range("E187").Value = 12 And shtExtraction.Range("E19").Value = "Actu." Then
               Sheets(Array("Fiche 0", "Eval 1", "12 ans")).Select
 
            Else
 
            If shtExtraction.Range("E19").Value = "CE" Then
               Sheets(Array("Fiche 0", "Fiche 2", "Fiche 3", "Fiche 4", "Fiche 5", "Fiche 6", "Eval 1", "Eval 2")).Select
 
            Else
 
            Sheets(Array("Fiche 0", "Eval 1", "Eval 2")).Select
 
            End If
 
            End If
 
            End If
 
            ActiveSheet.ExportAsFixedFormat _
                        Type:=xlTypePDF, _
                        Filename:=PDFFileName, _
                        Quality:=xlQualityStandard, _
                        IncludeDocProperties:=True, _
                        IgnorePrintAreas:=False, _
                        OpenAfterPublish:=False
 
 
shtExtraction.Select
shtExtraction.Range("E1:E299").ClearContents
shtExtraction.Range("E2").Select
 
 
shtExtraction.Select
shtExtraction.Range("A1").Select
 
Application.CutCopyMode = False
Application.ScreenUpdating = True
 
 
End Sub
Mais j'ai alors une erreur de compilation au niveau de cette ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
 Sub_PDF_All CStr(Cell(1, 1).Value)
Je n'arrive pas à comprendre ce qui ne fonctionne pas. Avez-vous une idée ?

Merci d'avance,