Re : Impression pdf
bonjour le forum
après a force de chercher j'ai trouvé, la persévérance a payé , j'ai eu une étincelle ce matin, ce n'est peut être pas très orthodoxe mais ça marche
je masque les feuilles à ne pas imprimer en début de code et je les affiche en fin de code
je sais les puristes trouverons sans doute cela plus que moyen comme solution mais vu mon niveau je m'en contenterai
je met donc le code ci dessous au cas ou quelqu'un aurait le même souci
bonne journée
Sub Pdf()
Worksheets("procedure").Visible = False
Worksheets("oriclef").Visible = False
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
NomExcel = ThisWorkbook.Name
NomPdf = Left(NomExcel, Len(NomExcel) - 4) & ".pdf"
With pdfjob
If .cstart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutisaveDirectory") = 1
.cOption("AutosaveDirectory") = ThisWorkbook.Path
.cOption("AutosaveFilename") = Application.InputBox("INDIQUEZ LE NOM DE SAUVEGARDE ", "Choix du nom", "pesée alpage-" & Format(Date, "yyyymmdd"), , , , , 2)
.cOption("AutosaveFormat") = 0
.cClearCache
End With
ThisWorkbook.PrintOut copies:=1, ActivePrinter:="PDFCreator"
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
With pdfjob
.cDefaultprinter = DefaultPrinter
.cClearCache
.cClose
End With
Set pdfjob = Nothing
Worksheets("oriclef").Visible = True
Worksheets("procedure").Visible = True
End Sub