Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

impression PDF sous Vista

2 réponses
Avatar
Michel_de_+
Bonjour à tous,

J'ai récupéré et adapté un petit bout de code pour imprimer une feuille sur
les imprimantes disponibles dont PDF Créator. Sur tous les postes en XP, ça
marche bien mais par contre sur les postes en Vista, je ne peux pas sortir
de PDF...

Un bon génie de derrière la lampe de mon écran cathodique aurait-il un petit
bout de début d'idée ou encore mieux la solution.

Ci-joint le code :



Sub impression()
Dim ChoixImprim As Variant

Sheets("IMPRESSION").Select

If Application.Dialogs(xlDialogPrinterSetup).Show = False Then
GoTo 10

Else
ChoixImprim = ActivePrinter

If InStr(ChoixImprim, "Creator") > 0 Then
'MsgBox "imprimante pdf"
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
''/// Changer le nom du fichier de sortie sur la lign cidessous: ///
sPDFName = ActiveSheet.Range("c5").Value
sPDFPath = "c:\"
''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 "Fermer PDFCreator et relancer l'impression", vbCritical
+ _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Imprime le document en PDF
ActiveSheet.PrintOut Copies:=1, ActivePrinter:="PDFCreator"
'Attend que le document soit entré dans la file d'impression
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
'Attend que l'impression du document soit terminée
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
Set pdfjob = Nothing
MsgBox "le fichier " & sPDFName & " est sauvegardé sur " & sPDFPath

GoTo 10
End If

ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
MsgBox " Impression terminée "
End If

10
Sheets("donnees").Select
initialisation

End Sub

2 réponses

Avatar
Azo4
sous office 2007, il existe un plug-in pour pdf :

http://www.microsoft.com/downloads/details.aspx?FamilyIDñFC413C-6D89-4F15-991B-63B07BA5F2E5&displaylang=fr

--
--
Serge CENCI
MVP MS Windows
https://mvp.support.microsoft.com/profile/Serge.Cenci
http://www.communautes-numeriques.net/

"Michel_de_+" a écrit dans le message de
news:uAjD$
Bonjour à tous,

J'ai récupéré et adapté un petit bout de code pour imprimer une feuille
sur les imprimantes disponibles dont PDF Créator. Sur tous les postes en
XP, ça marche bien mais par contre sur les postes en Vista, je ne peux pas
sortir de PDF...

Un bon génie de derrière la lampe de mon écran cathodique aurait-il un
petit bout de début d'idée ou encore mieux la solution.

Ci-joint le code :



Sub impression()
Dim ChoixImprim As Variant

Sheets("IMPRESSION").Select

If Application.Dialogs(xlDialogPrinterSetup).Show = False Then
GoTo 10

Else
ChoixImprim = ActivePrinter

If InStr(ChoixImprim, "Creator") > 0 Then
'MsgBox "imprimante pdf"
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
''/// Changer le nom du fichier de sortie sur la lign cidessous: ///
sPDFName = ActiveSheet.Range("c5").Value
sPDFPath = "c:"
''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 "Fermer PDFCreator et relancer l'impression", vbCritical
+ _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Imprime le document en PDF
ActiveSheet.PrintOut Copies:=1, ActivePrinter:="PDFCreator"
'Attend que le document soit entré dans la file d'impression
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
'Attend que l'impression du document soit terminée
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
Set pdfjob = Nothing
MsgBox "le fichier " & sPDFName & " est sauvegardé sur " & sPDFPath

GoTo 10
End If

ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
MsgBox " Impression terminée "
End If

10
Sheets("donnees").Select
initialisation

End Sub



Avatar
Michel_de_+
J'ai oublié de le préciser mais je suis sous office 2003 et j'ai installé
PDF Creator 0.9.5

Michel

"Azo4" a écrit dans le message de
news:%
sous office 2007, il existe un plug-in pour pdf :

http://www.microsoft.com/downloads/details.aspx?FamilyIDñFC413C-6D89-4F15-991B-63B07BA5F2E5&displaylang=fr

--
--
Serge CENCI
MVP MS Windows
https://mvp.support.microsoft.com/profile/Serge.Cenci
http://www.communautes-numeriques.net/

"Michel_de_+" a écrit dans le message de
news:uAjD$
Bonjour à tous,

J'ai récupéré et adapté un petit bout de code pour imprimer une feuille
sur les imprimantes disponibles dont PDF Créator. Sur tous les postes en
XP, ça marche bien mais par contre sur les postes en Vista, je ne peux
pas sortir de PDF...

Un bon génie de derrière la lampe de mon écran cathodique aurait-il un
petit bout de début d'idée ou encore mieux la solution.

Ci-joint le code :



Sub impression()
Dim ChoixImprim As Variant

Sheets("IMPRESSION").Select

If Application.Dialogs(xlDialogPrinterSetup).Show = False Then
GoTo 10

Else
ChoixImprim = ActivePrinter

If InStr(ChoixImprim, "Creator") > 0 Then
'MsgBox "imprimante pdf"
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
''/// Changer le nom du fichier de sortie sur la lign cidessous: ///
sPDFName = ActiveSheet.Range("c5").Value
sPDFPath = "c:"
''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 "Fermer PDFCreator et relancer l'impression",
vbCritical + _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
'Imprime le document en PDF
ActiveSheet.PrintOut Copies:=1, ActivePrinter:="PDFCreator"
'Attend que le document soit entré dans la file d'impression
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
'Attend que l'impression du document soit terminée
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
Set pdfjob = Nothing
MsgBox "le fichier " & sPDFName & " est sauvegardé sur " & sPDFPath

GoTo 10
End If

ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
MsgBox " Impression terminée "
End If

10
Sheets("donnees").Select
initialisation

End Sub