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
|
Sub Sauver2PagesPDF_Box()
Dim chemin, pdfpath As String, page1, page2, PageNew1, PageNew2 As Page, Tempo As New Publisher.Application, _
Npage1, Npage2 As Long
Set page1 = ActiveDocument.Pages(1)
Set page2 = ActiveDocument.Pages(2)
chemin = ActiveDocument.Name
pdfpath = Left(chemin, Len(chemin) - 3)
Npage1 = InputBox("Combien de page1 ?", "Titre", 1)
Npage2 = InputBox("Combien de page2 ?", "Titre", 1)
Tempo.Open Filename:="D:\Autres\Imprimer\test.pub"
With ActiveDocument
.Pages(2).Shapes.Range.Copy
Tempo.ActiveDocument.Pages(2).Shapes.Paste
Set PageNew2 = Tempo.ActiveDocument.Pages.Add(Count:=(Npage2 - 1), After:=2, DuplicateObjectsOnPage:=2)
.Pages(1).Shapes.Range.Copy
Tempo.ActiveDocument.Pages(1).Shapes.Paste
Set PageNew1 = Tempo.ActiveDocument.Pages.Add(Count:=(Npage1 - 1), After:=1, DuplicateObjectsOnPage:=1)
End With
Tempo.ActiveDocument.ExportAsFixedFormat pbFixedFormatTypePDF, _
"E:\Autres\Imprimer\" & pdfpath & "pdf"
Tempo.ActiveDocument.Close
Set Tempo = Nothing
ActiveDocument.Save
End Sub |
Partager