How to separate a Word document and save it as separate PDF files?

In Word, you can save the entire document as a PDF file, but have you ever tried splitting the document and saving each page as a separate PDF file? In this article, I will introduce methods to accomplish this quickly.

Split the Word document and save as separate PDF files using VBA

Here, VBA code can help you directly divide the Word document by page and then save it as separate PDF files.

1. Press Alt + F11 to open the Microsoft Visual Basic for Application window.

2. Click Insert > Module, copy and paste the code below into the Module window.

VBA: Save Word as separate PDFs

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

3. Press F5, in the Browse for Folder dialog, select the folder to place the PDF files.

How to separate a Word document and save it as separate PDF files

How to separate a Word document and save it as separate PDF files

4. Click OK, then input the page numbers you want to split from and to.

Click OK. Now the pages have been saved as separate PDF files.

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart