Skip to main content

How to batch convert multiple Word documents to pdf files?

Author: Siluvia Last Modified: 2025-01-24

It is easy for you to convert a Word document to a PDF file with the Save as function in Word. But what if you need to convert all Word documents in a folder into separate PDF files at once? This guide will walk you through how to batch convert multiple Word documents to PDF files in Word.

Batch convert multiple Word documents to pdf files with VBA
Batch convert multiple Word documents to pdf files with Kutools for Word


Batch convert multiple Word documents to pdf files with VBA

The following VBA code allows you to quickly convert all Word documents in a folder to PDF files at once. Follow these steps:

  1. In Word, press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  2. In the Microsoft Visual Basic for Applications window, click Insert > Module, then copy and paste the following VBA code into the Module window.
    Sub ConvertWordsToPdfs()
    'Updated by Extendoffice 20181123
        Dim xIndex As String
        Dim xDlg As FileDialog
        Dim xFolder As Variant
        Dim xNewName As String
        Dim xFileName As String
        Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
        If xDlg.Show <> -1 Then Exit Sub
        xFolder = xDlg.SelectedItems(1) + "\"
        xFileName = Dir(xFolder & "*.*", vbNormal)
        While xFileName <> ""
            If ((Right(xFileName, 4)) <> ".doc" Or Right(xFileName, 4) <> ".docx") Then
                xIndex = InStr(xFileName, ".") + 1
                xNewName = Replace(xFileName, Mid(xFileName, xIndex), "pdf")
                Documents.Open FileName:=xFolder & xFileName, _
                    ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
                    PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
                    WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
                    wdOpenFormatAuto, XMLTransform:=""
                ActiveDocument.ExportAsFixedFormat OutputFileName:=xFolder & xNewName, _
                    ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
                    wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
                    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
                    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
                    BitmapMissingFonts:=True, UseISO19005_1:=False
                ActiveDocument.Close
            End If
            xFileName = Dir()
        Wend
    End Sub

    Module window with the above code pasted

  3. Press F5 to run the code.
  4. A Browse dialog will pop up. Select the folder containing the Word documents you want to convert to PDFs, and click OK.
  5. Browse dialog box

All Word documents in the selected folder will be converted to separate PDF files. See screenshot:

All Word documents in the selected folder are converted to separate PDF files


Batch convert multiple Word documents to pdf files with Kutools for Word

If VBA code is hard to handle, you can try the Convert documents utility of Kutools for Word. This tool simplifies the process, making it more accessible and efficient compared to manual methods in Word.

Kutools for Word, equipped with AI πŸ€–, offers over 100 handy features to simplify your tasks.
  1. Click Kutools Plus > Doc/Docx.

    Doc/Docx button on the Kutools Plus tab on the ribbon

  2. In the Document Format Converter window, follow these steps:
    1. Select Convert docx to pdf from the Format Convert drop-down menu.
    2. Click Add button to add documents:
      Add menu
      • Choose Files to add individual documents.
      • Choose Folder to add all documents from a specific folder.
    3. By default, PDF files will be saved to the same location as the source files. To change the location, click the Browse button Browse button and choose a new destination.
    4. Optionally, check the Delete source files after conversion box to remove the original files after the PDFs are created.
    5. Optionally, check the Keep the modified date of original files box to retain the original file metadata.
    6. Once all settings are complete, click Ok.

    Document Format Converter window

Now, all .docx format documents have been successfully converted to PDF files.

Kutools for Word is the ultimate Word add-in that streamlines your work and boosts your document processing skills. Get It Now!

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

πŸ€– Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...

πŸ“˜ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

✏ Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

βž• Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...

πŸ” Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...

⭐ Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...

Kutools and Kutools Plus tabs on the Word Ribbon
πŸ‘‰ Want to try these features? Download Kutools for Word now! πŸš€
 

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word