![]() |
#1
|
|||
|
|||
![]()
I've found this code online that allows me to split each page into PDF and save it. However, I need to change it so that it splits every 2 pages. So each PDF document will have 2 pages. So the first document will have pages 1 and 2. The second document will have 3 and 4, and so on.
Here's the code I have so far. Code:
Sub SaveAsSeparatePDFs() 'UpdatebyExtendoffice20181120 Dim I As Long Dim xDlg As FileDialog Dim xFolder As Variant Dim xStart, xEnd As Integer On Error GoTo lbl Set xDlg = Application.FileDialog(msoFileDialogFolderPicker) If xDlg.Show <> -1 Then Exit Sub xFolder = xDlg.SelectedItems(1) xStart = CInt(InputBox("Start Page", "KuTools for Word")) xEnd = CInt(InputBox("End Page:", "KuTools for Word")) If xStart <= xEnd Then For I = xStart To xEnd ActiveDocument.ExportAsFixedFormat OutputFileName:= _ xFolder & "\Page_" & I & ".pdf", ExportFormat:=wdExportFormatPDF, _ OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _ wdExportFromTo, From:=I, To:=I, Item:=wdExportDocumentContent, _ IncludeDocProps:=False, KeepIRM:=False, CreateBookmarks:= _ wdExportCreateHeadingBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=False, UseISO19005_1:=False Next End If Exit Sub lbl: MsgBox "Enter right page number", vbInformation, "KuTools for Word" End Sub Many thanks for all your help in advance <3 Last edited by macropod; 07-19-2022 at 07:38 AM. Reason: Added code tags |
Tags |
splitting |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ScarlettNZ | Mail Merge | 1 | 05-30-2019 12:53 AM |
![]() |
Julian | Word VBA | 5 | 12-08-2015 04:51 AM |
Splitting Word Document based on line content | TwiceOver | Word VBA | 23 | 10-12-2015 02:01 PM |
Document splitting | MsLavigne | Word | 2 | 05-09-2012 05:52 AM |
![]() |
dlawson | Word | 4 | 04-14-2009 12:22 PM |