Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" a écrit dans le message de news:
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
uViqSXlzIHA.2068@TK2MSFTNGP05.phx.gbl...
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" a écrit dans le message de news:
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" a écrit dans le message de news:
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" <scrat83@free.fr> a écrit dans le message de news:
uViqSXlzIHA.2068@TK2MSFTNGP05.phx.gbl...
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Ok, ça fonctionne très bien !
Évidemment, il faut ajouter la bibliothèque suivante :
PDFCreator
(fenêtre de l'éditeur de code / barre des menus / outils / références
P.S - Attention si certaines lignes de ce code sont coupées par
la messagerie.
'-----------------------------------------------
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim PdfJob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
Dim Test As String
'Emplacement des fichiers à renseigner
'Ne pas oublier d'inscrire le "" à la fin du chemin.
Chemin = ""C:Transfert"
"
Set PdfJob = New PDFCreator.clsPDFCreator
For i = 1 To Worksheets.Count
With Worksheets(i)
.Activate
'Abandon de la macro si la feuille est vide
If IsEmpty(.UsedRange) Then
Set PdfJob = Nothing
Exit Sub
End If
NomPDF = .Name
Test:
' Vérifier si un fichier portant ce nom existe
If Dir(Chemin & NomPDF & ".pdf") <> "" Then
If MsgBox("Un fichier ayant ce nom " & NomPDF & " existe " & _
"déjà dans ce répertoire " & Chemin & "." & vbCrLf & _
"Désirez-vous l'écraser? ", vbCritical + vbYesNo,
"Attention") = vbNo Then
NomPDF = Application.InputBox("Donner lui un nouveau
nom.")
If Format(NomPDF) = False Then
MsgBox "Opération de la Création des fichiers PDF
annulée."
Else
GoTo Test:
End If
End If
End If
With PdfJob
If i = 1 Then
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical _
+ vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
End With
Next
PdfJob.cClose
Set PdfJob = Nothing
SupprimerPDFCreator
End Sub
'-----------------------------------------------
Sub SupprimerPDFCreator()
'Supprimer le processus dans le Gestionnaire des tâches
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'PDFCreator.exe'")
For Each objProcess In colProcessList
objProcess.Terminate
Next
End Sub
'-----------------------------------------------
"Domi" a écrit dans le message de news:
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" <lecocosteph@frite.fr> a écrit dans le message de news:
uh9sh5wzIHA.2408@TK2MSFTNGP04.phx.gbl...
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lSteph
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" <lecocosteph@frite.fr> a écrit dans le message de news:
uh9sh5wzIHA.2408@TK2MSFTNGP04.phx.gbl...
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lSteph
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Hi,
Pour ma part je viens de faire des essais chez moi (j'avais la version 9.5
de PDFCreator que j'ai remplacé au cas ou par la 9.3 au préalable)
Ca marche, aucun plantage ;o))
Un petit souci tout de même, c'est que, tel que le code est fait
actuellement, si la feuille n°3 est vide, les suivantes ne sont pas
"imprimées" à cause du Exit Sub...
Ma config XP Pro / PDFCretor 9.3 / Excel 2007 en mode de compatibilité avec
2000/2003 (que j'ai au boulot)
A+
Domi
"MichDenis" a écrit dans le message de news:
%23Zd$| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Hi,
Pour ma part je viens de faire des essais chez moi (j'avais la version 9.5
de PDFCreator que j'ai remplacé au cas ou par la 9.3 au préalable)
Ca marche, aucun plantage ;o))
Un petit souci tout de même, c'est que, tel que le code est fait
actuellement, si la feuille n°3 est vide, les suivantes ne sont pas
"imprimées" à cause du Exit Sub...
Ma config XP Pro / PDFCretor 9.3 / Excel 2007 en mode de compatibilité avec
2000/2003 (que j'ai au boulot)
A+
Domi
"MichDenis" <michdenis@hotmail.com> a écrit dans le message de news:
%23Zd$kJxzIHA.4040@TK2MSFTNGP04.phx.gbl...
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" <lecocosteph@frite.fr> a écrit dans le message de news:
uh9sh5wzIHA.2408@TK2MSFTNGP04.phx.gbl...
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lSteph
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
Hi,
Pour ma part je viens de faire des essais chez moi (j'avais la version 9.5
de PDFCreator que j'ai remplacé au cas ou par la 9.3 au préalable)
Ca marche, aucun plantage ;o))
Un petit souci tout de même, c'est que, tel que le code est fait
actuellement, si la feuille n°3 est vide, les suivantes ne sont pas
"imprimées" à cause du Exit Sub...
Ma config XP Pro / PDFCretor 9.3 / Excel 2007 en mode de compatibilité avec
2000/2003 (que j'ai au boulot)
A+
Domi
"MichDenis" a écrit dans le message de news:
%23Zd$| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui
me
permettent d'enregistrer un onglet au format pdf avec pdfCreator
installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
As-tu eu des messages d'erreurs ?...
Il m'est difficile de solutionner un problème ...
J'aurais aimé que tu sois plus précis
Merci pour ton commentaire, mais cela ne fait pas avancer
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
As-tu eu des messages d'erreurs ?...
Il m'est difficile de solutionner un problème ...
J'aurais aimé que tu sois plus précis
Merci pour ton commentaire, mais cela ne fait pas avancer
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" <lecocosteph@frite.fr> a écrit dans le message de news:
uh9sh5wzIHA.2408@TK2MSFTNGP04.phx.gbl...
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lSteph
Bonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub
As-tu eu des messages d'erreurs ?...
Il m'est difficile de solutionner un problème ...
J'aurais aimé que tu sois plus précis
Merci pour ton commentaire, mais cela ne fait pas avancer
| Selon version certainement, l'impression "en postscript" n'est pas gérée
| pour du "multifeuille", seul la zone d'impression de la feuille active
| est considérée.
J'aurais aimé que tu sois plus précis dans ton commentaire :
Selon version : D'EXCEL OU PDFCREATOR ?
Quelle version "Excel" ou "PdfCreator" as-tu testé qui ne fonctionne pas ?
Quel est ton système d'exploitation ?
As-tu eu des messages d'erreurs ? Si oui, Lesquels ?
As-tu exécuté la procédure pas à pas ? Sur quelle ligne
de code, Excel semble perdre le contrôle ?
Merci pour ton commentaire, mais cela ne fait pas avancer
beaucoup la problématique de beaucoup !
Il m'est difficile de solutionner un problème si je ne peux pas
le reproduire et que je n'ai aucun indice sur la problématique
que d'autres usagers connaissent.
"LSteph" a écrit dans le message de news:
Bonsoir,
Selon version certainement, l'impression "en postscript" n'est pas gérée
pour du "multifeuille", seul la zone d'impression de la feuille active
est considérée.
Alternative,
spliter les pages dans word, ou
générer par macro autant de classeurs que de pages à imprimer,
définir pdfcreator comme imprimante par défaut.
Depuis l'explorateur sélectionner les fichiers à imprimer.
--
lStephBonsoir à tous,en fouillant, j'ai fini par trouver des bouts de codes qui me
permettent d'enregistrer un onglet au format pdf avec pdfCreator installé.
Ca marche nickel pour la première feuille mais c'est tout... il y a
visiblement un problème dans la boucle...
Quelqu'un saurait-il me dire où est l'erreur ?
Merci
Domi
Sub PrintToPDFbyPDFCreator()
'Author: Ken Puls
Dim pdfjob As PDFCreator.clsPDFCreator
Dim NomPDF As String
Dim Chemin As String
For i = 1 To Sheets.Count
Sheets(i).Select
MsgBox ActiveSheet.Name
'Nom et emplacement des fichiers
NomPDF = ActiveSheet.Name 'ou Range("C4").Value 'ou On peut mettre
directement un nom comme ="toto.pdf"...
Chemin = "C:Transfert"
'Abandon de la macro si la feuille est vide
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") = Chemin
.cOption("AutosaveFilename") = NomPDF
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Enregistrement de la feuille au format pdf par pdfCretor
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'''Sheets(i).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
pdfjob.cClose
Set pdfjob = Nothing
Next
End Sub