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
| Option Explicit
Sub LancerImprimerParSectionEnPdf()
Dim I As Integer
Dim RepertoireCible As String
Dim MonRange As Range
RepertoireCible = ActiveDocument.Path ' A adapter
Application.ScreenUpdating = False
With ActiveDocument
For I = 1 To .Sections.Count
With .Sections(I)
.Range.Select
Set MonRange = Selection.Range
MonRange.SetRange Start:=MonRange.Start, End:=MonRange.End - 2
MonRange.Select
ImprimerParSectionEnPdf RepertoireCible, I
Set MonRange = Nothing
End With
Next I
End With
MsgBox "Fin de traitement !", vbInformation
End Sub
Sub ImprimerParSectionEnPdf(ByVal RepertoireCible2 As String, ByVal PageChoisie As Integer)
Dim NomDuDocument As String
NomDuDocument = RepertoireCible2 & "\Agent " & Format(PageChoisie, "00") & ".pdf"
' Application.ScreenUpdating = False
'
Application.PrintOut _
FileName:="", _
outputfilename:=NomDuDocument, _
Range:=wdPrintSelection, _
Item:=wdPrintDocumentWithMarkup, _
Copies:=1, _
PageType:=wdPrintAllPages, _
Collate:=True, _
Background:=True, _
PrintToFile:=True, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Application.ScreenUpdating = True
End Sub |
Partager