If you've ever faced a folder containing dozens or hundreds of Word documents that all need to become PDFs, you know the pain of doing them one by one. Each manual conversion takes 30β60 seconds β manageable for five files, tedious for twenty, and completely impractical for hundreds. Here are four ways to convert Word files to PDF in bulk.
Method 1: Microsoft Word Macro (VBA)
If you have Microsoft Word installed, a short VBA macro can convert an entire folder of Word documents to PDF automatically. Here's how:
- Open Microsoft Word.
- Press Alt+F11 to open the VBA editor.
- Go to Insert β Module and paste the following code:
Sub BatchConvertToPDF()
Dim folderPath As String
Dim fileName As String
folderPath = "C:\Your\Folder\Path\" ' β Change this
fileName = Dir(folderPath & "*.doc*")
Do While fileName <> ""
Dim doc As Document
Set doc = Documents.Open(folderPath & fileName)
doc.ExportAsFixedFormat folderPath & Replace(fileName, ".docx", ".pdf"), wdExportFormatPDF
doc.Close False
fileName = Dir
Loop
MsgBox "Done! All files converted."
End Sub
Change the folderPath to your actual folder, then press F5 to run. The macro opens each Word file, exports it as PDF to the same folder, and closes it. For 100 files, this typically takes 5β10 minutes unattended.
Method 2: PowerShell Script (Windows)
PowerShell can automate Word via COM automation. This script converts all DOCX files in a folder:
$word = New-Object -ComObject Word.Application
$word.Visible = $false
$folder = "C:\Your\Folder"
Get-ChildItem $folder -Filter "*.docx" | ForEach-Object {
$doc = $word.Documents.Open($_.FullName)
$pdfPath = $_.FullName -replace "\.docx$", ".pdf"
$doc.SaveAs([ref]$pdfPath, [ref]17) # 17 = wdFormatPDF
$doc.Close()
}
$word.Quit()
Save this as a .ps1 file and run from PowerShell (you may need to enable script execution with Set-ExecutionPolicy RemoteSigned).
Method 3: Python with python-docx and LibreOffice
For cross-platform automation, Python combined with LibreOffice's headless mode is highly effective:
import subprocess
import os
folder = "/path/to/your/folder"
for filename in os.listdir(folder):
if filename.endswith(('.docx', '.doc')):
filepath = os.path.join(folder, filename)
subprocess.run(['libreoffice', '--headless', '--convert-to', 'pdf', '--outdir', folder, filepath])
This requires LibreOffice to be installed. It works on Windows, Mac, and Linux.
Method 4: Command Line with LibreOffice
LibreOffice can be run directly from the command line to convert files:
libreoffice --headless --convert-to pdf *.docx
Run this command in the folder containing your Word files. LibreOffice will convert all matching files to PDF in the current directory. This single command can process hundreds of files. The quality is slightly lower than Microsoft Word's native output but is excellent for most purposes.
Handling Different File Types in Batch
Your batch conversion script should handle both .doc and .docx files. The older .doc format (Word 97β2003) requires the same conversion but some tools handle it differently:
- Microsoft Word handles both formats natively.
- LibreOffice handles both formats well.
- Python's python-docx library only handles .docx, not .doc. For .doc files, use LibreOffice or Microsoft Word automation.
Logging and Error Handling
For production batch conversion, add error handling to your scripts. Some Word files may be corrupted, password-protected, or in use by another process. A robust script should:
- Log each successful conversion with timestamp.
- Log errors with the filename and error message.
- Skip failed files and continue processing rather than stopping entirely.
- Generate a summary report at the end: X files processed, Y successes, Z failures.
Performance Benchmarks
| Method | 100 Files (~1MB each) | Quality | Platform |
|---|---|---|---|
| Word VBA Macro | ~8 minutes | Excellent | Windows |
| PowerShell + Word | ~8 minutes | Excellent | Windows |
| Python + LibreOffice | ~12 minutes | Very Good | All |
| LibreOffice CLI | ~10 minutes | Very Good | All |
Need to Convert a Single File Right Now?
For one-off conversions, our free online tool is the fastest option β no setup required.
Convert Word to PDF β Free