bonjour à tous,

je me permets de demander encore de l'aide pour un problème d'impression via un userform et une impression en pdf spécifique
en fait, j'ai récupérer une macro qui permet de générer la liste de tous les onglets. suite à cela, je peut les sélectionner en les cochant et lancer une impression : Sheets(Me.ListBox1.List(x)).PrintOut , Copies:=1, ActivePrinter:="PDFCreator"

cette macro d'impression correspond à ceci :
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
Private Sub CommandButton5_Click()
 
Dim x As Byte
Dim verif As Boolean
verif = False
 
For x = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(x) = True Then
verif = True
Sheets(Me.ListBox1.List(x)).Activate
SavePdf
End If
Next 
If verif = False Then MsgBox "Pas de selection pour impression"
End Sub
 
sachant que SavePdf est une autre macro : 
'Author : Ken Puls (Excelguru.ca | Tips and pointers for Excel and other MS Office applications)
'Macro Purpose: Print to PDF file using PDFCreator
' (Download from SourceForge.net: PDFCreator)
' Designed for early bind, set reference to PDFCreator
Dim pdfjob As PDFCreator.clsPDFCreator
'Dim pdfjob As Object 'liaison tardive
Dim sPDFName As String
Dim sPDFPath As String
Dim RetVal As Variant
'/// Change the output file name here! ///
ActiveSheet.Select
sPDFName = "A1" 'ici la cellule du nom de fichier
sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
'Check if worksheet is empty and exit if so
If IsEmpty(ActiveSheet.UsedRange) Then Exit Sub
Set pdfjob = New PDFCreator.clsPDFCreator
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
'.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveDirectory") = Range("A2") 'ici la cellule sur le chemin
.cOption("AutosaveFilename") = Range("A1") ' ici la cellule sur le nom du fichier
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Print the document to PDF
ActiveSheet.Select
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
RetVal = Shell("Taskkill /IM PDFCreator.exe /F", 0)
' pdfjob.cClose
'Set pdfjob = Nothing
End Sub
Mon problème :
suite à ma volonté d'enregistrer en pdf mes onglets via la macro ci-dessus, il m'est devenu impossible de cocher plusieurs onglets en même temps.
le premier onglet s'imprime correctement mais dès le deuxième onglet la macro plante via :
MsgBox "Can't initialize PDFCreator."

comment peut-on faire pour éviter cela car je ne maîtrise pas tous les concepts????????????

Merci d'avance pour votre aide

Cordialement
Yannick