Word : Une Macro pour imprimer en PDF

Intérêt :

  • Permet d’imprimer en 1 seul clic un document au format PDF
  • Utile après Insertion d’une signature pour envoyer une ordonnance à un patient par COURRIEL.

Prérequis :

PDFCREATOR doit être installé et le système redémarré

 

Macro = PDF :

Sub PDF()

Sub PDF()

‘ PDF Macro
‘ Macro enregistrée le 21/02/2015 par PC USER

ActivePrinter = “PDFCreator”

With Options
.UpdateFieldsAtPrint = False
.UpdateLinksAtPrint = False
.DefaultTray = “Utiliser config. imprimante”
.PrintBackground = False
.PrintProperties = False
.PrintFieldCodes = False
.PrintComments = False
.PrintHiddenText = False
.PrintXMLTag = False
.PrintDrawingObjects = True
.PrintDraft = False
.PrintReverse = False
.MapPaperSize = True
.PrintOddPagesInAscendingOrder = True
.PrintEvenPagesInAscendingOrder = True
.PrintBackgrounds = False
End With

With ActiveDocument
.PrintPostScriptOverText = False
.PrintFormsData = False
End With

Application.PrintOut FileName:=””, Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:=””, PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=False, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

ActivePrinter = “Brother HL-5250DN series”
End Sub

Explications :

  1. ActivePrinter = “PDFCreator”
    • Définit PDFCreator comme canal d’impression par défaut !
  2. Application.PrintOut FileName:=””
    • Lance l’impression virtuelle
  3. ActivePrinter = “Brother HL-5250DN series”
    • Très Important de remettre l’imprimante par défaut à sa place, sinon toute les impression de Windows sont partir en PDF

NOTES :

  • Les noms des imprimantes sont spécifiques des utilisateurs
  • Ce qui ne pose aucun souci avec l’Enregistreur de MACROS

TRUC :

  • Placer la Macro PDF sur un bouton de barre d’outil

 

Laisser un commentaire