Fix: Word PDF Export Fails When Microsoft Word Desktop Is Missing
Identify whether Word Desktop is absent, unavailable to the current Windows user, blocked during automation, or able to start but unable to complete a real PDF export.
Quick answer: test Word automation and PDF export separately
First launch Word Desktop interactively under the same Windows user, confirm activation and dismiss any first-run prompts. Then test CreateObject("Word.Application"). If that succeeds, create a disposable DOCX and export a disposable PDF. Only the full probe confirms that Word automation and its PDF engine worked together.
Cannot create Word.Application → automation unavailable. Word starts but DOCX save fails → file or profile problem. DOCX saves but PDF export fails → Word PDF stage or environment problem. Full probe passes → test the real template next.
Locate the failure before choosing a remedy
Word is not installed
The Windows machine has no locally installed Word Desktop application registered for automation.
Word is installed for another environment
The operator may have web access, a remote app, or a different Windows profile, while the macro’s local user lacks the desktop automation object.
COM activation is damaged or blocked
Word exists, but registration, policy, security software, profile state, or installation damage prevents Word.Application from starting.
Word waits for interactive setup
Activation, privacy, add-in, recovery, template, or first-run dialogs can block a hidden automation session.
DOCX works but PDF export fails
Word automation starts, yet file permissions, fonts, links, protection, add-ins, or the fixed-format engine interrupt the export step.
The execution model is wrong
An attended desktop test does not establish readiness for a service account, scheduled task without a user session, web server, or concurrent automation host.
Run six checks on the intended workstation
1. Use the real Windows user
Sign in as the account that will run the batch. Do not assume another administrator’s successful test applies.
2. Start Word interactively
Open Word Desktop, confirm it is activated, create a blank document, save it, and export a PDF manually.
3. Close blocking dialogs
Resolve recovery panes, add-in prompts, Normal template warnings, protected-view decisions, and first-run screens.
4. Check local write access
Use a simple local folder owned by the user. Prove DOCX and PDF writes before testing a network or synchronized path.
5. Run the disposable probe
Test COM startup, DOCX save, and PDF export without opening or modifying a production template.
6. Test one real document
After the probe passes, run one approved template and inspect its fonts, images, fields, pagination, DOCX, and PDF.
Free Excel VBA helper: prove the local Word-to-PDF path
Save the Excel file as an Excel Macro-Enabled Workbook (.xlsm), place this code in a standard module, and run RunWordPdfHealthCheck. The macro creates a unique WordPdfHealthChecks run folder beside the workbook. It never opens a production document.
Windows-only scope
The example checks the local Windows desktop automation path used by Excel VBA. It does not test Word for the web or another remote machine.
Real COM activation
CreateObject("Word.Application") starts a separate hidden Word instance. Failure is reported as automation unavailable, not automatically as “Word absent.”
Disposable DOCX test
The macro creates a new blank document containing known text and saves it as WordPdfProbe.docx.
Real PDF test
The same disposable document is exported through Word’s fixed-format method, then both files must exist and have nonzero size.
Clean Word shutdown
The probe closes its document, marks the loaded Normal template as already handled to avoid a save prompt, quits only the Word instance it created, and restores Excel screen updating.
Retained evidence
After the run folder is created, a success or failure report records the stage, error, operating system, Word version/build when available, probe paths, and the need for a real-template test.
Option Explicit
Private Const WORD_FORMAT_XML_DOCUMENT As Long = 12
Private Const WORD_EXPORT_FORMAT_PDF As Long = 17
Private Const WORD_EXPORT_OPTIMIZE_FOR_PRINT As Long = 0
Private Const WORD_EXPORT_ALL_DOCUMENT As Long = 0
Private Const WORD_EXPORT_DOCUMENT_CONTENT As Long = 0
Private Const WORD_EXPORT_CREATE_NO_BOOKMARKS As Long = 0
Private Const WORD_DO_NOT_SAVE_CHANGES As Long = 0
Private Const WORD_ALERTS_NONE As Long = 0
Public Sub RunWordPdfHealthCheck()
Dim fso As Object
Dim wdApp As Object
Dim wdDoc As Object
Dim outputRoot As String
Dim runFolder As String
Dim probeDocxPath As String
Dim probePdfPath As String
Dim logPath As String
Dim failureLogPath As String
Dim wordVersion As String
Dim wordBuild As String
Dim previousScreenUpdating As Boolean
Dim screenStateCaptured As Boolean
Dim currentStep As String
Dim errorNumber As Long
Dim errorDescription As String
On Error GoTo CleanFail
previousScreenUpdating = Application.ScreenUpdating
screenStateCaptured = True
Application.ScreenUpdating = False
currentStep = "checking the Excel host"
If InStr(1, Application.OperatingSystem, "Windows", _
vbTextCompare) = 0 Then
Err.Raise vbObjectError + 4900, , _
"This health check requires Windows desktop automation."
End If
If Len(ThisWorkbook.Path) = 0 Then
Err.Raise vbObjectError + 4901, , _
"Save the macro-enabled Excel workbook before running the check."
End If
Set fso = CreateObject("Scripting.FileSystemObject")
outputRoot = JoinPath(ThisWorkbook.Path, "WordPdfHealthChecks")
EnsureFolder outputRoot
runFolder = CreateRunFolder(fso, outputRoot)
probeDocxPath = JoinPath(runFolder, "WordPdfProbe.docx")
probePdfPath = JoinPath(runFolder, "WordPdfProbe.pdf")
logPath = JoinPath(runFolder, "HealthCheck.txt")
failureLogPath = JoinPath(runFolder, "HealthCheckFailure.txt")
currentStep = "starting Microsoft Word Desktop automation"
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = False
wdApp.DisplayAlerts = WORD_ALERTS_NONE
wdApp.ScreenUpdating = False
wordVersion = CStr(wdApp.Version)
wordBuild = CStr(wdApp.Build)
currentStep = "creating the disposable Word probe"
Set wdDoc = wdApp.Documents.Add
wdDoc.Content.Text = _
"Word PDF health check" & vbCrLf & _
"Created: " & Format$(Now, "yyyy-mm-dd hh:nn:ss") & vbCrLf & _
"This disposable document tests Word automation and PDF export."
currentStep = "saving the disposable DOCX"
RequireTargetAbsent probeDocxPath
wdDoc.SaveAs2 probeDocxPath, WORD_FORMAT_XML_DOCUMENT
RequireNonemptyFile probeDocxPath, "probe DOCX"
currentStep = "exporting the disposable PDF"
RequireTargetAbsent probePdfPath
wdDoc.ExportAsFixedFormat _
probePdfPath, _
WORD_EXPORT_FORMAT_PDF, _
False, _
WORD_EXPORT_OPTIMIZE_FOR_PRINT, _
WORD_EXPORT_ALL_DOCUMENT, _
1, _
1, _
WORD_EXPORT_DOCUMENT_CONTENT, _
False, _
True, _
WORD_EXPORT_CREATE_NO_BOOKMARKS, _
True, _
True, _
False
RequireNonemptyFile probePdfPath, "probe PDF"
currentStep = "closing the disposable Word instance"
wdDoc.Close WORD_DO_NOT_SAVE_CHANGES
Set wdDoc = Nothing
wdApp.NormalTemplate.Saved = True
wdApp.Quit WORD_DO_NOT_SAVE_CHANGES
Set wdApp = Nothing
currentStep = "writing the success report"
WriteHealthCheckLog fso, logPath, "PASS", currentStep, 0, "", _
wordVersion, wordBuild, probeDocxPath, probePdfPath
RequireNonemptyFile logPath, "health-check report"
Application.ScreenUpdating = previousScreenUpdating
screenStateCaptured = False
MsgBox "Word PDF health check passed." & vbCrLf & _
"Word version: " & wordVersion & _
IIf(Len(wordBuild) > 0, " (build " & wordBuild & ")", "") & _
vbCrLf & "Probe DOCX: " & probeDocxPath & _
vbCrLf & "Probe PDF: " & probePdfPath & _
vbCrLf & "Report: " & logPath & vbCrLf & vbCrLf & _
"This proves the local probe worked. Test the real template separately.", _
vbInformation, "Word PDF Health Check"
CleanExit:
On Error Resume Next
If Not wdDoc Is Nothing Then _
wdDoc.Close WORD_DO_NOT_SAVE_CHANGES
If Not wdApp Is Nothing Then
wdApp.NormalTemplate.Saved = True
wdApp.Quit WORD_DO_NOT_SAVE_CHANGES
End If
If screenStateCaptured Then _
Application.ScreenUpdating = previousScreenUpdating
Set wdDoc = Nothing
Set wdApp = Nothing
Set fso = Nothing
On Error GoTo 0
Exit Sub
CleanFail:
errorNumber = Err.Number
errorDescription = Err.Description
On Error Resume Next
If Not wdDoc Is Nothing Then _
wdDoc.Close WORD_DO_NOT_SAVE_CHANGES
If Not wdApp Is Nothing Then
wdApp.NormalTemplate.Saved = True
wdApp.Quit WORD_DO_NOT_SAVE_CHANGES
End If
If Not fso Is Nothing And Len(failureLogPath) > 0 Then
If Not FileExistsQuiet(failureLogPath) Then
WriteHealthCheckLog fso, failureLogPath, "FAIL", currentStep, _
errorNumber, errorDescription, wordVersion, wordBuild, _
probeDocxPath, probePdfPath
End If
End If
If screenStateCaptured Then _
Application.ScreenUpdating = previousScreenUpdating
Set wdDoc = Nothing
Set wdApp = Nothing
Set fso = Nothing
On Error GoTo 0
MsgBox FailureMessage(errorNumber, currentStep, errorDescription, _
runFolder), vbCritical, "Word PDF Health Check Failed"
End Sub
Private Function FailureMessage(ByVal errorNumber As Long, _
ByVal currentStep As String, _
ByVal errorDescription As String, _
ByVal runFolder As String) As String
Dim guidance As String
If InStr(1, currentStep, "starting Microsoft Word", _
vbTextCompare) > 0 Then
guidance = "Word automation could not be created. Word Desktop may " & _
"be missing, damaged, unregistered, blocked by policy, or not " & _
"initialized for this Windows user."
ElseIf errorNumber = 429 Then
guidance = "An automation component failed before the Word startup " & _
"stage. Use the recorded stage to identify that component; this " & _
"error does not prove that Word Desktop is missing."
ElseIf InStr(1, currentStep, "exporting", vbTextCompare) > 0 Then
guidance = "Word started, but the PDF probe failed. Check activation, " & _
"first-run dialogs, permissions, security policy, and the local " & _
"Word installation."
Else
guidance = "The check stopped before it could prove the full DOCX-to-PDF path."
End If
FailureMessage = guidance & vbCrLf & vbCrLf & _
"Stage: " & currentStep & vbCrLf & _
"Error " & errorNumber & ": " & errorDescription & vbCrLf & _
IIf(Len(runFolder) > 0, _
"Retained evidence folder: " & runFolder, _
"No evidence folder was created.") & vbCrLf & vbCrLf & _
"The macro does not install Word or change Office registration."
End Function
Private Sub WriteHealthCheckLog(ByVal fso As Object, _
ByVal logPath As String, _
ByVal resultText As String, _
ByVal stageText As String, _
ByVal errorNumber As Long, _
ByVal errorDescription As String, _
ByVal wordVersion As String, _
ByVal wordBuild As String, _
ByVal probeDocxPath As String, _
ByVal probePdfPath As String)
Dim stream As Object
RequireTargetAbsent logPath
Set stream = fso.CreateTextFile(logPath, False, True)
stream.WriteLine "WORD PDF HEALTH CHECK"
stream.WriteLine "Created=" & Format$(Now, "yyyy-mm-dd hh:nn:ss")
stream.WriteLine "Result=" & resultText
stream.WriteLine "Stage=" & SanitizeLogValue(stageText)
stream.WriteLine "ErrorNumber=" & errorNumber
stream.WriteLine "ErrorDescription=" & SanitizeLogValue(errorDescription)
stream.WriteLine "ExcelOperatingSystem=" & _
SanitizeLogValue(Application.OperatingSystem)
stream.WriteLine "WordVersion=" & SanitizeLogValue(wordVersion)
stream.WriteLine "WordBuild=" & SanitizeLogValue(wordBuild)
stream.WriteLine "ProbeDOCX=" & SanitizeLogValue(probeDocxPath)
stream.WriteLine "ProbePDF=" & SanitizeLogValue(probePdfPath)
stream.WriteLine "RealTemplateTestRequired=True"
stream.WriteLine "UnattendedServerReadinessProven=False"
stream.Close
End Sub
Private Function SanitizeLogValue(ByVal valueText As String) As String
SanitizeLogValue = Replace(valueText, vbCr, " ")
SanitizeLogValue = Replace(SanitizeLogValue, vbLf, " ")
SanitizeLogValue = Replace(SanitizeLogValue, "=", "-")
End Function
Private Function CreateRunFolder(ByVal fso As Object, _
ByVal outputRoot As String) As String
Dim baseFolder As String
Dim candidate As String
Dim suffix As Long
baseFolder = "Run_" & Format$(Now, "yyyymmdd_hhnnss")
candidate = JoinPath(outputRoot, baseFolder)
Do While fso.FolderExists(candidate)
suffix = suffix + 1
candidate = JoinPath(outputRoot, baseFolder & "_" & _
Format$(suffix, "000"))
Loop
fso.CreateFolder candidate
CreateRunFolder = candidate
End Function
Private Sub EnsureFolder(ByVal folderPath As String)
If FolderExistsStrict(folderPath) Then Exit Sub
On Error GoTo CreateFailed
MkDir folderPath
Exit Sub
CreateFailed:
Err.Raise vbObjectError + 4902, , _
"Could not create folder: " & folderPath & ". " & Err.Description
End Sub
Private Sub RequireTargetAbsent(ByVal filePath As String)
If FileExistsStrict(filePath) Then
Err.Raise vbObjectError + 4903, , _
"Refusing to overwrite existing file: " & filePath
End If
End Sub
Private Sub RequireNonemptyFile(ByVal filePath As String, _
ByVal fileLabel As String)
If Not FileExistsStrict(filePath) Then
Err.Raise vbObjectError + 4904, , _
"Missing " & fileLabel & ": " & filePath
End If
On Error GoTo SizeFailed
If FileLen(filePath) <= 0 Then
Err.Raise vbObjectError + 4905, , _
"Empty " & fileLabel & ": " & filePath
End If
Exit Sub
SizeFailed:
If Err.Number >= vbObjectError + 4904 And _
Err.Number <= vbObjectError + 4905 Then
Err.Raise Err.Number, , Err.Description
End If
Err.Raise vbObjectError + 4906, , _
"Could not inspect " & fileLabel & ": " & filePath & _
". " & Err.Description
End Sub
Private Function FileExistsStrict(ByVal filePath As String) As Boolean
Dim resultText As String
On Error GoTo CheckFailed
resultText = Dir$(filePath, vbNormal Or vbHidden Or vbSystem Or vbReadOnly)
FileExistsStrict = (Len(resultText) > 0)
Exit Function
CheckFailed:
Err.Raise vbObjectError + 4907, , _
"Could not check file path: " & filePath & ". " & Err.Description
End Function
Private Function FileExistsQuiet(ByVal filePath As String) As Boolean
On Error Resume Next
FileExistsQuiet = _
(Len(Dir$(filePath, vbNormal Or vbHidden Or vbSystem Or vbReadOnly)) > 0)
On Error GoTo 0
End Function
Private Function FolderExistsStrict(ByVal folderPath As String) As Boolean
Dim resultText As String
On Error GoTo CheckFailed
resultText = Dir$(folderPath, vbDirectory)
If Len(resultText) = 0 Then
FolderExistsStrict = False
Else
FolderExistsStrict = _
((GetAttr(folderPath) And vbDirectory) = vbDirectory)
End If
Exit Function
CheckFailed:
Err.Raise vbObjectError + 4908, , _
"Could not check folder path: " & folderPath & ". " & Err.Description
End Function
Private Function JoinPath(ByVal parentPath As String, _
ByVal childName As String) As String
If Right$(parentPath, 1) = "\" Then
JoinPath = parentPath & childName
Else
JoinPath = parentPath & "\" & childName
End If
End FunctionMicrosoft documents Excel-to-Word automation through CreateObject and the Word Application object, the PDF parameters exposed by Document.ExportAsFixedFormat, and the risks of unattended Office automation.
Interpret the health-check result correctly
PASS: local probe completed
The current user started Word automation, saved the disposable DOCX, exported a nonempty PDF, and closed that Word instance. Continue with one real-template test.
FAIL at Word startup
Check local installation, activation, user profile, registration, security policy, and first-run state. Escalate installation or repair work instead of hiding it in the macro.
FAIL at DOCX save
Check the run folder, permissions, disk state, controlled-folder policy, path behavior, and whether Word displayed a hidden dialog.
FAIL at PDF export
Word is present, so investigate the fixed-format stage, activation, policy, fonts, add-ins, and the exact user environment before blaming the template.
Choose a fallback that matches the real dependency
Keep DOCX-only output temporarily
Use this only when the workflow can legitimately stop before PDF release. Label the result incomplete and keep the PDF requirement visible.
Move the attended run to a prepared workstation
Use a controlled Windows user with Word Desktop, tested fonts, permissions, templates, add-ins, and output folders.
Choose a different supported renderer
If Word Desktop cannot be part of the architecture, select a renderer designed for the actual source format and revalidate layout, fields, images, accessibility, and output rules.
Redesign unattended execution
Do not promote an attended VBA proof into a service or web-server design. Review Microsoft’s automation guidance, licensing, isolation, concurrency, and monitoring requirements.
Know what the probe cannot prove
No installation repair
The macro does not install Word, activate Office, edit the registry, repair COM registration, or change organizational policy.
No production-template proof
A blank disposable document cannot expose every font, link, field, image, add-in, protection, or pagination problem in a real template.
No unattended certification
An interactive user-session pass is not evidence that a Windows service, server process, or non-interactive scheduled task is supported or stable.
No concurrent-load proof
One probe does not establish safe parallel Word instances, throughput, resource limits, recovery, or batch-scale behavior.
No PDF quality review
Nonzero file size does not prove correct fonts, pages, links, images, tags, bookmarks, accessibility, or visual appearance.
No permanent readiness guarantee
Updates, policy, profile changes, activation, add-ins, and machine state can change after a successful run. Repeat the check after material environment changes.
Use DocxForge Pro only on a prepared Word Desktop workstation
DocxForge Pro runs locally with Microsoft Word Desktop. It can standardize Word-template generation after the workstation dependency is satisfied; it does not install Word, repair Office, or substitute a server-side PDF engine.
Contractor: one case, several different documents
Review one case dataset, then create several different documents for that case from different Word templates. Use it for a coordinated case pack on a prepared workstation.
Factory: many rows, one standard template
Apply one standard Word template to many independent Excel rows. Every selected row creates a separate document for the same repeatable document type.
Do not use the product as a workaround for missing Word Desktop, a damaged Office installation, or an unsupported unattended server design. Resolve and test the execution environment first.
Contractor: different Word templates for one reviewed case
Review the case data, then choose the different documents required for the pack.


Factory: one standard Word template for independent rows
Review the selected Excel rows, then run the standard template on the prepared workstation.


Frequently asked questions
Does error 429 prove that Microsoft Word Desktop is not installed?
No. Error 429 means the automation object could not be created. Word may be missing, but damaged registration, policy, a user-profile problem, a first-run state, or another local configuration issue can produce the same symptom.
Can Word for the web satisfy an Excel VBA call to Word.Application?
No. CreateObject("Word.Application") targets the locally registered Windows desktop automation object. Access to Word for the web does not provide that COM object to an Excel VBA macro.
Does a successful health check prove that the real batch will work?
No. It proves that the current Windows user could start Word automation, save a disposable DOCX, and export a nonempty PDF at that moment. The real template can still fail because of fonts, links, add-ins, protection, fields, paths, permissions, or document-specific content.
Should the macro repair Office registration or install Word automatically?
No. The example records the failing stage and leaves evidence. Installation, activation, repair, policy, and registration changes belong to the user or administrator and should not be hidden inside a document-generation macro.
Can I treat an attended workstation check as proof for a Windows service or web server?
No. Office desktop applications were designed for an interactive user environment. Microsoft does not recommend or support unattended, non-interactive Office automation in several server and service contexts. Test and license the actual execution model separately.
Where does DocxForge Pro fit?
DocxForge Pro uses local Microsoft Word Desktop. Contractor creates several different documents for one reviewed case from different Word templates. Factory applies one standard Word template to many independent Excel rows and creates a separate output for each selected row. It does not replace a missing Word installation or act as a server-side PDF engine.