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
-- -- 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
--
--
Serge CENCI
MVP MS Windows
https://mvp.support.microsoft.com/profile/Serge.Cenci
http://www.communautes-numeriques.net/
sergioENLEVERfrance@orange.fr
"Michel_de_+" <michel@malbarre.fr> a écrit dans le message de
news:uAjD$FoEJHA.4960@TK2MSFTNGP05.phx.gbl...
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
-- -- 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
Michel_de_+
J'ai oublié de le préciser mais je suis sous office 2003 et j'ai installé PDF Creator 0.9.5
-- -- 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
J'ai oublié de le préciser mais je suis sous office 2003 et j'ai installé
PDF Creator 0.9.5
Michel
"Azo4" <sergeENLEVERazo@mvps.org> a écrit dans le message de
news:%23RoamMpEJHA.768@TK2MSFTNGP05.phx.gbl...
--
--
Serge CENCI
MVP MS Windows
https://mvp.support.microsoft.com/profile/Serge.Cenci
http://www.communautes-numeriques.net/
sergioENLEVERfrance@orange.fr
"Michel_de_+" <michel@malbarre.fr> a écrit dans le message de
news:uAjD$FoEJHA.4960@TK2MSFTNGP05.phx.gbl...
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
-- -- 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