1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| Sub ImprimerPDF()
Dim oldPrinter As String
Dim strDir As String
Dim strFichier As String
Dim strTitle, strSubject, strAuthor, strKeywords As String
' Affichage de la fenêtre de PDF
Shell "C:\Program Files\PDFCreator\PDFCreator.exe", vbNormalFocus
Dim PDFCreator1 As New clsPDFCreator
'Choix de l imprimante
oldPrinter = ActivePrinter
ActivePrinter = "PDFCreator"
'parametres d impression
strDir = "c:\monrepertoire"
strFichier = "mondocumentpdf.pdf"
strTitle = "mon titre"
strSubject = "mon sujet"
strAuthor = "p.nom"
strKeywords = "mots cles"
With PDFCreator1
.cStart
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = strDir
.cOption("AutosaveFilename") = strFichier
.cOption("AutosaveFormat") = 0
'marche pas
'.cOptions.StandardAuthor = strAuthor
'.cOptions.StandardKeywords = strKeywords
'.cOptions.StandardSubject = strSubject
'.cOptions.StandardTitle = strTitle
'marche pas non plus
.clsPDFCreatorOptions.StandardAuthor = strAuthor
.clsPDFCreatorOptions.StandardKeywords = strKeywords
.clsPDFCreatorOptions.StandardSubject = strSubject
.clsPDFCreatorOptions.StandardTitle = strTitle
'bordel y a rien qui marche
'.cOption("StandardSubject") = strSubject
'.cOption("StandardAuthor") = strAuthor
'.cOption("StandardTitle") = strTitle
'.cOption("StandardKeywords") = strKeywords
.cClearCache
End With
ActiveDocument.PrintOut Background:=True
PDFCreator1.cClose
'remise de l imprimante par defaut
ActivePrinter = oldPrinter
End Sub |
Partager