Factory Home Inspection Reports

Excel → Word → PDF Workflow for Home Inspection Reports

Run a Factory-style workflow: validate complete Excel rows, apply one standard Word template, and create a separate editable DOCX and optional PDF for every report row.

Many Excel rows
One Word template
One report per row
DOCX + optional PDF
This article follows Factory logic: many complete Excel rows generate from one standard template. Article №13 follows Contractor logic for one complex inspection case and several document types.

Quick answer: every row must already be a complete report record

Factory logic works when one Excel row contains all fixed values required by one standard Word template. The batch validates every row first, then opens a clean template copy and creates one separately named report for each row.

Many complete rows

Each row represents one independent report, not one finding within a larger inspection case.

One fixed template

Every output uses the same bookmarks, styles, fixed wording, branding, and optional cover-photo position.

One stable ReportID

Use the ID for filenames, duplicate detection, issue reporting, reruns, and release tracking.

One output per row

Create an editable DOCX and, when enabled, a PDF without silently replacing existing files.

Keep article №14 separate from article №13

This guide follows Factory logic: many rows, one template. The detailed home inspection guide follows Contractor logic: one property case, related findings and photos, and several document types from different templates.

Build a flat Excel contract for the standard report

Create a Reports sheet with exact headers in row 1. Keep display values ready for Word instead of relying on Excel column width or local number formats.

Required column order (row 1): A — ReportID; B — ClientName; C — PropertyAddress; D — InspectionDateDisplay; E — InspectorName; F — OverallCondition; G — SummaryText; H — CoverPhotoPath; I — ReportStatus.

ReportID

Required text identifier for the output filename. Format the column as Text before importing IDs when leading zeros matter.

ClientName and PropertyAddress

Store the reviewed display values required by the standard report. Do not use them as filenames.

InspectionDateDisplay

Prepare the exact date wording for the document, such as 17 November 2026.

InspectorName

Store the approved display name. The macro does not authenticate the inspector or create a signature.

OverallCondition

Use a controlled reviewed value that fits the template's wording and downstream review process.

SummaryText

Provide final narrative text. This batch does not derive findings or write an inspection conclusion.

CoverPhotoPath

Optionally provide a path relative to Photos, such as HI-0042\front.jpg.

ReportStatus

Use READY as a generation gate. It does not prove review, approval, signing, or delivery.

The one-row-to-one-document guide explains the core mapping before it is scaled into a batch.

Use one standard Word template for the entire batch

Put StandardInspectionReport.docx in Templates beside the workbook. Add eight exact bookmarks.

Seven text bookmarks

Add ReportID, ClientName, PropertyAddress, InspectionDate, InspectorName, OverallCondition, and SummaryText.

Required bookmark, optional photo

Add the required CoverPhoto bookmark at a fixed location. The macro embeds the file or clears the bookmark content when CoverPhotoPath is blank.

Stable styles and layout

Control headings, tables, spacing, page breaks, headers, footers, and branding through the template.

Variable-length tests

Test long addresses, names, summaries, portrait photos, landscape photos, and reports without a photo.

Free VBA fallback: validate the batch, then generate

The macro snapshots columns A–I, validates every row and photo before Word starts, rejects duplicate or existing output names, checks the fixed template once, then generates every report from the same in-memory snapshot.

Required setup

Save the workbook as .xlsm. Create the nine exact columns described above. Put the template at Templates\StandardInspectionReport.docx and optional images below Photos. The macro creates GeneratedInspectionReports.

Expected filenames

For ReportID HI-0042, the output is GeneratedInspectionReports\Inspection_HI-0042.docx plus optional GeneratedInspectionReports\Inspection_HI-0042.pdf.

Option Explicit

Private Const wdFormatXMLDocument As Long = 12
Private Const wdExportFormatPDF As Long = 17
Private Const wdExportOptimizeForPrint As Long = 0
Private Const wdDoNotSaveChanges As Long = 0
Private Const wdAlertsNone As Long = 0
Private Const wdCollapseStart As Long = 1
Private Const msoTrue As Long = -1
Private Const MAX_PHOTO_WIDTH_POINTS As Double = 453.54
Private Const MAX_PHOTO_HEIGHT_POINTS As Double = 283.46

Public Sub GenerateStandardInspectionReportBatch()
    Const DATA_SHEET As String = "Reports"
    Const TEMPLATE_SUBFOLDER As String = "Templates"
    Const TEMPLATE_FILE As String = "StandardInspectionReport.docx"
    Const PHOTO_SUBFOLDER As String = "Photos"
    Const OUTPUT_SUBFOLDER As String = "GeneratedInspectionReports"
    Const REQUIRED_STATUS As String = "READY"
    Const CREATE_PDF As Boolean = True

    Dim ws As Worksheet
    Dim fso As Object
    Dim plannedNames As Object
    Dim wdApp As Object
    Dim wdDoc As Object
    Dim lastCell As Range
    Dim dataRows As Variant
    Dim lastRow As Long
    Dim dataRow As Long
    Dim excelRow As Long
    Dim generatedCount As Long
    Dim reportId As String
    Dim clientName As String
    Dim propertyAddress As String
    Dim inspectionDateText As String
    Dim inspectorName As String
    Dim overallCondition As String
    Dim summaryText As String
    Dim coverPhotoRelative As String
    Dim coverPhotoFull As String
    Dim reportStatus As String
    Dim fileStem As String
    Dim templatePath As String
    Dim photoRoot As String
    Dim outputFolder As String
    Dim docxPath As String
    Dim pdfPath As String
    Dim currentStep As String
    Dim previousScreenUpdating As Boolean
    Dim screenStateCaptured As Boolean
    Dim errorNumber As Long
    Dim errorDescription As String

    On Error GoTo CleanFail
    previousScreenUpdating = Application.ScreenUpdating
    screenStateCaptured = True
    Application.ScreenUpdating = False

    currentStep = "checking the workbook"
    If Len(ThisWorkbook.Path) = 0 Then
        Err.Raise vbObjectError + 2400, , _
            "Save this Excel workbook before running the macro."
    End If
    Set ws = ThisWorkbook.Worksheets(DATA_SHEET)
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set plannedNames = CreateObject("Scripting.Dictionary")
    plannedNames.CompareMode = vbTextCompare

    RequireHeader ws, 1, "ReportID"
    RequireHeader ws, 2, "ClientName"
    RequireHeader ws, 3, "PropertyAddress"
    RequireHeader ws, 4, "InspectionDateDisplay"
    RequireHeader ws, 5, "InspectorName"
    RequireHeader ws, 6, "OverallCondition"
    RequireHeader ws, 7, "SummaryText"
    RequireHeader ws, 8, "CoverPhotoPath"
    RequireHeader ws, 9, "ReportStatus"

    templatePath = ThisWorkbook.Path & "\" & TEMPLATE_SUBFOLDER & _
        "\" & TEMPLATE_FILE
    photoRoot = ThisWorkbook.Path & "\" & PHOTO_SUBFOLDER
    outputFolder = ThisWorkbook.Path & "\" & OUTPUT_SUBFOLDER
    If Not fso.FileExists(templatePath) Then
        Err.Raise vbObjectError + 2401, , _
            "Word template not found: " & templatePath
    End If

    Set lastCell = ws.Range("A:I").Find( _
        What:="*", _
        After:=ws.Cells(1, 1), _
        LookIn:=xlValues, _
        LookAt:=xlPart, _
        SearchOrder:=xlByRows, _
        SearchDirection:=xlPrevious, _
        MatchCase:=False, _
        SearchFormat:=False)
    If lastCell Is Nothing Then
        Err.Raise vbObjectError + 2402, , _
            "No report rows were found on the Reports sheet."
    End If
    If lastCell.Row < 2 Then
        Err.Raise vbObjectError + 2402, , _
            "No report rows were found on the Reports sheet."
    End If
    lastRow = lastCell.Row
    dataRows = ws.Range("A2:I" & lastRow).Value2

    'Pass 1: validate the entire snapshot before Word starts.
    For dataRow = 1 To UBound(dataRows, 1)
        excelRow = dataRow + 1
        currentStep = "validating Excel row " & excelRow
        reportId = RequiredArrayText(dataRows(dataRow, 1), _
            "ReportID", excelRow)
        clientName = RequiredArrayText(dataRows(dataRow, 2), _
            "ClientName", excelRow)
        propertyAddress = RequiredArrayText(dataRows(dataRow, 3), _
            "PropertyAddress", excelRow)
        inspectionDateText = RequiredArrayText(dataRows(dataRow, 4), _
            "InspectionDateDisplay", excelRow)
        inspectorName = RequiredArrayText(dataRows(dataRow, 5), _
            "InspectorName", excelRow)
        overallCondition = RequiredArrayText(dataRows(dataRow, 6), _
            "OverallCondition", excelRow)
        summaryText = RequiredArrayText(dataRows(dataRow, 7), _
            "SummaryText", excelRow)
        coverPhotoRelative = OptionalArrayText(dataRows(dataRow, 8), _
            "CoverPhotoPath", excelRow)
        reportStatus = RequiredArrayText(dataRows(dataRow, 9), _
            "ReportStatus", excelRow)

        If StrComp(reportStatus, REQUIRED_STATUS, vbTextCompare) <> 0 Then
            Err.Raise vbObjectError + 2403, , _
                "Excel row " & excelRow & " is not marked READY."
        End If

        fileStem = SafeWindowsName(reportId)
        If Len(fileStem) = 0 Then
            Err.Raise vbObjectError + 2404, , _
                "ReportID cannot create a safe filename on Excel row " & _
                excelRow & "."
        End If
        If plannedNames.Exists(fileStem) Then
            Err.Raise vbObjectError + 2405, , _
                "Duplicate ReportID after filename cleanup on Excel row " & _
                excelRow & ": " & fileStem
        End If
        plannedNames.Add fileStem, excelRow

        If Len(coverPhotoRelative) > 0 Then
            coverPhotoFull = ResolvePhotoPath(fso, photoRoot, _
                coverPhotoRelative, excelRow)
            If Not fso.FileExists(coverPhotoFull) Then
                Err.Raise vbObjectError + 2406, , _
                    "Cover photo not found on Excel row " & excelRow & _
                    ": " & coverPhotoFull
            End If
            If fso.GetFile(coverPhotoFull).Size = 0 Then
                Err.Raise vbObjectError + 2407, , _
                    "Cover photo is empty on Excel row " & excelRow & _
                    ": " & coverPhotoFull
            End If
        End If

        docxPath = outputFolder & "\Inspection_" & fileStem & ".docx"
        pdfPath = outputFolder & "\Inspection_" & fileStem & ".pdf"
        If fso.FileExists(docxPath) Or _
           (CREATE_PDF And fso.FileExists(pdfPath)) Then
            Err.Raise vbObjectError + 2408, , _
                "Output already exists for Excel row " & excelRow & _
                ": " & fileStem
        End If
    Next dataRow

    EnsureFolder fso, outputFolder
    currentStep = "starting Microsoft Word"
    Set wdApp = CreateObject("Word.Application")
    wdApp.Visible = False
    wdApp.DisplayAlerts = wdAlertsNone
    wdApp.ScreenUpdating = False

    'Open once to validate the fixed Factory template before generation.
    currentStep = "checking the Word template"
    Set wdDoc = wdApp.Documents.Open(templatePath, False, True, False)
    RequireBookmark wdDoc, "ReportID"
    RequireBookmark wdDoc, "ClientName"
    RequireBookmark wdDoc, "PropertyAddress"
    RequireBookmark wdDoc, "InspectionDate"
    RequireBookmark wdDoc, "InspectorName"
    RequireBookmark wdDoc, "OverallCondition"
    RequireBookmark wdDoc, "SummaryText"
    RequireBookmark wdDoc, "CoverPhoto"
    wdDoc.Close wdDoNotSaveChanges
    Set wdDoc = Nothing

    'Pass 2: generate from the validated in-memory snapshot.
    For dataRow = 1 To UBound(dataRows, 1)
        excelRow = dataRow + 1
        reportId = Trim$(CStr(dataRows(dataRow, 1)))
        clientName = Trim$(CStr(dataRows(dataRow, 2)))
        propertyAddress = Trim$(CStr(dataRows(dataRow, 3)))
        inspectionDateText = Trim$(CStr(dataRows(dataRow, 4)))
        inspectorName = Trim$(CStr(dataRows(dataRow, 5)))
        overallCondition = Trim$(CStr(dataRows(dataRow, 6)))
        summaryText = Trim$(CStr(dataRows(dataRow, 7)))
        coverPhotoRelative = Trim$(CStr(dataRows(dataRow, 8)))
        fileStem = SafeWindowsName(reportId)
        docxPath = outputFolder & "\Inspection_" & fileStem & ".docx"
        pdfPath = outputFolder & "\Inspection_" & fileStem & ".pdf"
        coverPhotoFull = ""
        If Len(coverPhotoRelative) > 0 Then
            coverPhotoFull = ResolvePhotoPath(fso, photoRoot, _
                coverPhotoRelative, excelRow)
            If Not fso.FileExists(coverPhotoFull) Then
                Err.Raise vbObjectError + 2409, , _
                    "Cover photo disappeared after preflight on Excel row " & _
                    excelRow & "."
            End If
            If fso.GetFile(coverPhotoFull).Size = 0 Then
                Err.Raise vbObjectError + 2409, , _
                    "Cover photo became empty after preflight on Excel row " & _
                    excelRow & "."
            End If
        End If

        If fso.FileExists(docxPath) Or _
           (CREATE_PDF And fso.FileExists(pdfPath)) Then
            Err.Raise vbObjectError + 2410, , _
                "Output appeared after preflight for Excel row " & _
                excelRow & ": " & fileStem
        End If

        currentStep = "opening the template for Excel row " & excelRow
        Set wdDoc = wdApp.Documents.Open(templatePath, False, True, False)
        WriteRequiredBookmark wdDoc, "ReportID", reportId
        WriteRequiredBookmark wdDoc, "ClientName", clientName
        WriteRequiredBookmark wdDoc, "PropertyAddress", propertyAddress
        WriteRequiredBookmark wdDoc, "InspectionDate", inspectionDateText
        WriteRequiredBookmark wdDoc, "InspectorName", inspectorName
        WriteRequiredBookmark wdDoc, "OverallCondition", overallCondition
        WriteRequiredBookmark wdDoc, "SummaryText", summaryText
        If Len(coverPhotoFull) > 0 Then
            InsertPictureAtBookmark wdDoc, "CoverPhoto", coverPhotoFull
        Else
            ClearOptionalBookmark wdDoc, "CoverPhoto"
        End If

        currentStep = "saving DOCX for Excel row " & excelRow
        wdDoc.SaveAs2 docxPath, wdFormatXMLDocument, False, "", False
        If CREATE_PDF Then
            currentStep = "exporting PDF for Excel row " & excelRow
            wdDoc.ExportAsFixedFormat pdfPath, wdExportFormatPDF, False, _
                wdExportOptimizeForPrint
        End If
        wdDoc.Close wdDoNotSaveChanges
        Set wdDoc = Nothing
        generatedCount = generatedCount + 1
    Next dataRow

    MsgBox generatedCount & " inspection report(s) generated in:" & _
        vbCrLf & outputFolder, vbInformation

CleanExit:
    On Error Resume Next
    If Not wdDoc Is Nothing Then wdDoc.Close wdDoNotSaveChanges
    If Not wdApp Is Nothing Then wdApp.Quit wdDoNotSaveChanges
    If screenStateCaptured Then Application.ScreenUpdating = previousScreenUpdating
    Set wdDoc = Nothing
    Set wdApp = Nothing
    Set plannedNames = 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 wdDoNotSaveChanges
    If Not wdApp Is Nothing Then wdApp.Quit wdDoNotSaveChanges
    If screenStateCaptured Then Application.ScreenUpdating = previousScreenUpdating
    Set wdDoc = Nothing
    Set wdApp = Nothing
    Set plannedNames = Nothing
    Set fso = Nothing
    On Error GoTo 0
    MsgBox "Batch stopped while " & currentStep & "." & vbCrLf & _
        "Error " & errorNumber & ": " & errorDescription, vbCritical
End Sub

Private Sub RequireHeader(ByVal ws As Worksheet, _
                          ByVal columnNumber As Long, _
                          ByVal expectedHeader As String)
    Dim headerValue As Variant
    headerValue = ws.Cells(1, columnNumber).Value2
    If IsError(headerValue) Then
        Err.Raise vbObjectError + 2411, , _
            "Header contains an Excel error in column " & columnNumber & "."
    End If
    If StrComp(Trim$(CStr(headerValue)), expectedHeader, _
               vbBinaryCompare) <> 0 Then
        Err.Raise vbObjectError + 2412, , _
            "Expected header '" & expectedHeader & "' in column " & _
            columnNumber & "."
    End If
End Sub

Private Function RequiredArrayText(ByVal sourceValue As Variant, _
                                   ByVal fieldName As String, _
                                   ByVal excelRow As Long) As String
    RequiredArrayText = OptionalArrayText(sourceValue, fieldName, excelRow)
    If Len(RequiredArrayText) = 0 Then
        Err.Raise vbObjectError + 2413, , _
            fieldName & " is required on Excel row " & excelRow & "."
    End If
End Function

Private Function OptionalArrayText(ByVal sourceValue As Variant, _
                                   ByVal fieldName As String, _
                                   ByVal excelRow As Long) As String
    If IsError(sourceValue) Then
        Err.Raise vbObjectError + 2414, , _
            fieldName & " contains an Excel error on row " & excelRow & "."
    End If
    OptionalArrayText = Trim$(CStr(sourceValue))
End Function

Private Sub RequireBookmark(ByVal doc As Object, _
                            ByVal bookmarkName As String)
    If Not doc.Bookmarks.Exists(bookmarkName) Then
        Err.Raise vbObjectError + 2415, , _
            "Required Word bookmark is missing: " & bookmarkName
    End If
End Sub

Private Sub WriteRequiredBookmark(ByVal doc As Object, _
                                  ByVal bookmarkName As String, _
                                  ByVal replacementText As String)
    Dim targetRange As Object
    Dim originalStyle As Variant
    Dim writtenText As String

    If Len(Trim$(replacementText)) = 0 Then
        Err.Raise vbObjectError + 2416, , _
            "Required value is blank for Word bookmark: " & bookmarkName
    End If
    RequireBookmark doc, bookmarkName
    Set targetRange = doc.Bookmarks(bookmarkName).Range
    originalStyle = targetRange.Style
    targetRange.Text = replacementText
    targetRange.Style = originalStyle
    doc.Bookmarks.Add bookmarkName, targetRange
    If Not doc.Bookmarks.Exists(bookmarkName) Then
        Err.Raise vbObjectError + 2417, , _
            "Word bookmark was not restored: " & bookmarkName
    End If
    writtenText = doc.Bookmarks(bookmarkName).Range.Text
    If Len(Trim$(writtenText)) = 0 Then
        Err.Raise vbObjectError + 2418, , _
            "Required bookmark is empty after replacement: " & bookmarkName
    End If
End Sub

Private Sub ClearOptionalBookmark(ByVal doc As Object, _
                                  ByVal bookmarkName As String)
    Dim targetRange As Object
    RequireBookmark doc, bookmarkName
    Set targetRange = doc.Bookmarks(bookmarkName).Range
    targetRange.Text = ""
    doc.Bookmarks.Add bookmarkName, targetRange
End Sub

Private Sub InsertPictureAtBookmark(ByVal doc As Object, _
                                    ByVal bookmarkName As String, _
                                    ByVal photoPath As String)
    Dim targetRange As Object
    Dim picture As Object
    RequireBookmark doc, bookmarkName
    Set targetRange = doc.Bookmarks(bookmarkName).Range
    targetRange.Text = ""
    targetRange.Collapse wdCollapseStart
    Set picture = doc.InlineShapes.AddPicture( _
        photoPath, False, True, targetRange)
    picture.LockAspectRatio = msoTrue
    If picture.Width > MAX_PHOTO_WIDTH_POINTS Then
        picture.Width = MAX_PHOTO_WIDTH_POINTS
    End If
    If picture.Height > MAX_PHOTO_HEIGHT_POINTS Then
        picture.Height = MAX_PHOTO_HEIGHT_POINTS
    End If
    doc.Bookmarks.Add bookmarkName, picture.Range
    If Not doc.Bookmarks.Exists(bookmarkName) Then
        Err.Raise vbObjectError + 2419, , _
            "Photo bookmark was not restored: " & bookmarkName
    End If
End Sub

Private Function ResolvePhotoPath(ByVal fso As Object, _
                                  ByVal photoRoot As String, _
                                  ByVal relativePath As String, _
                                  ByVal excelRow As Long) As String
    Dim normalizedRelative As String
    Dim absoluteRoot As String
    Dim absoluteCandidate As String
    normalizedRelative = Replace$(Trim$(relativePath), "/", "\")
    If Left$(normalizedRelative, 1) = "\" Or _
       InStr(1, normalizedRelative, ":", vbBinaryCompare) > 0 Then
        Err.Raise vbObjectError + 2420, , _
            "CoverPhotoPath must be relative to Photos on Excel row " & _
            excelRow & "."
    End If
    If normalizedRelative = ".." Or _
       Left$(normalizedRelative, 3) = "..\" Or _
       InStr(1, "\" & normalizedRelative & "\", _
             "\..\", vbTextCompare) > 0 Then
        Err.Raise vbObjectError + 2421, , _
            "CoverPhotoPath cannot leave Photos on Excel row " & _
            excelRow & "."
    End If
    absoluteRoot = fso.GetAbsolutePathName(photoRoot)
    absoluteCandidate = fso.GetAbsolutePathName( _
        absoluteRoot & "\" & normalizedRelative)
    If StrComp(Left$(absoluteCandidate, Len(absoluteRoot) + 1), _
               absoluteRoot & "\", vbTextCompare) <> 0 Then
        Err.Raise vbObjectError + 2422, , _
            "Resolved photo is outside Photos on Excel row " & excelRow & "."
    End If
    ResolvePhotoPath = absoluteCandidate
End Function

Private Sub EnsureFolder(ByVal fso As Object, ByVal folderPath As String)
    If Not fso.FolderExists(folderPath) Then fso.CreateFolder folderPath
End Sub

Private Function SafeWindowsName(ByVal rawName As String) As String
    Dim cleaned As String
    Dim invalidCharacters As Variant
    Dim invalidCharacter As Variant
    Dim characterCode As Long
    Dim baseName As String
    cleaned = Trim$(rawName)
    invalidCharacters = Array("<", ">", ":", Chr$(34), "/", _
        "\", "|", "?", "*")
    For Each invalidCharacter In invalidCharacters
        cleaned = Replace$(cleaned, CStr(invalidCharacter), "_")
    Next invalidCharacter
    For characterCode = 0 To 31
        cleaned = Replace$(cleaned, Chr$(characterCode), "_")
    Next characterCode
    Do While Len(cleaned) > 0 And _
        (Right$(cleaned, 1) = "." Or Right$(cleaned, 1) = " ")
        cleaned = Left$(cleaned, Len(cleaned) - 1)
    Loop
    If Len(cleaned) > 120 Then cleaned = Left$(cleaned, 120)
    Do While Len(cleaned) > 0 And _
        (Right$(cleaned, 1) = "." Or Right$(cleaned, 1) = " ")
        cleaned = Left$(cleaned, Len(cleaned) - 1)
    Loop
    If Len(cleaned) > 0 Then
        baseName = UCase$(Split(cleaned, ".")(0))
        Select Case baseName
            Case "CON", "PRN", "AUX", "NUL", _
                 "COM1", "COM2", "COM3", "COM4", "COM5", _
                 "COM6", "COM7", "COM8", "COM9", _
                 "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", _
                 "LPT6", "LPT7", "LPT8", "LPT9"
                cleaned = "_" & cleaned
        End Select
    End If
    SafeWindowsName = cleaned
End Function
Limits and failure model

READY is only a gate. The macro does not inspect a property, derive a condition, authenticate the inspector, approve wording, sign a report, or deliver it. The relative-path check rejects ordinary drive, UNC, and .. escapes but is not a complete defense against filesystem reparse points.

Data, photo, filename, and existing-output errors stop the complete batch before Word starts. A Word, template, or PDF error during generation stops the batch after any earlier outputs already saved. There is no automatic rollback; review the output folder before correcting and rerunning.

The macro uses Word's documented InlineShapes.AddPicture method, Bookmarks.Exists check, SaveAs2 method, and ExportAsFixedFormat method. Review the code statically and test it in Word Desktop with synthetic rows and disposable output before production use.

Control the complete Factory batch

The batch should fail visibly before generation when its source contract is invalid. Runtime failures need a separate recovery process because earlier rows may already have outputs.

Required-field preflight

Reject blank IDs, names, addresses, dates, inspectors, conditions, summaries, or statuses before Word starts.

Duplicate-name preflight

Detect collisions after Windows filename cleanup, including IDs that differ only by case.

Photo preflight

Reject missing, empty, absolute, UNC, or escaping photo paths before the first report is generated.

Template preflight

Open the template once and confirm all eight fixed bookmarks before processing report rows.

Fresh template per row

Open a clean read-only source template for every report so values cannot leak between outputs.

Explicit rerun process

Review partial outputs, correct the source, and decide which existing files to retain or remove before rerunning.

Use the duplicate filename guide when production naming requires more than one ID column.

Use DocxForge Pro Factory for the row-based workflow

DocxForge Pro Factory loads Excel rows, applies one Word template, configures naming and PDF options, and generates separate files for selected rows. Microsoft Word Desktop for Windows is required. Inspection judgment, review, signatures, delivery, and release approval remain outside the product.

What Factory replaces

In VBA, every header, bookmark, path, filename, optional image, error branch, and output rule becomes code that must be maintained and retested. Factory moves the recurring row selection, template, naming, DOCX, and PDF choices into the interface.

Factory: inspect Excel rows and generation settings

DocxForge Pro Factory Excel data screen for home inspection report rows
Inspect the rows selected for the report batch.
DocxForge Pro Factory document settings for one home inspection report template
Apply one template and output settings to selected rows.
Test one standard template with synthetic rows7 days free on the 3-month plan, then $38 every 3 months • 14-day refund after purchase
Factory batch workflowExcel row selectionOne Word templateDOCX + optional PDF
Start Free 7-Day Trial

Run a six-row Factory pilot

Use synthetic records, copied images, and a disposable output folder. Verify the full batch and its failure behavior.

1. Standard report

Generate one normal row and compare every value in Excel, DOCX, PDF, and the filename.

2. No cover photo

Leave CoverPhotoPath blank and confirm the placeholder is removed without a broken image.

3. Long summary

Use a long reviewed summary and inspect page breaks, tables, headers, footers, and PDF pagination.

4. Duplicate ID

Create two IDs that collide after filename cleanup and confirm Word never starts.

5. Missing photo

Reference a missing relative image and confirm the complete batch fails before output.

6. Existing output

Rerun a successful batch and confirm existing files are refused rather than overwritten.

For unavailable shared images, use the network photo folder troubleshooting guide.

Frequently asked questions

Short answers about Factory-style home inspection report batches.

What makes this a Factory workflow?

Many complete Excel rows use one standard Word template, and each selected row produces its own separately named document. The field mapping and output structure stay consistent across the batch.

How is this different from the Contractor home inspection article?

This article batches many flat report rows through one template. The Contractor article treats one complex property inspection as one case with related findings, photos, and several possible document types from different templates.

Can CoverPhotoPath be blank?

Yes. The photo is optional, but the CoverPhoto bookmark is required in the template. When the path is blank, the macro clears the bookmark content. If a path is provided, the file must exist, be nonempty, and resolve below the local Photos folder.

Does READY prove that a report is approved?

No. READY is only a batch gate. It does not authenticate the inspector, prove review authority, capture a signature, or create a release history.

Will the macro overwrite an existing report?

In an ordinary sequential run, existing DOCX and PDF names are blocked during preflight and checked again before generation. SaveAs2 itself can overwrite a file, so parallel writers or a shared output folder require additional synchronization.

What happens if row five fails during Word generation?

The batch stops. Reports already saved for earlier rows remain because the example has no automatic rollback. Review the output folder and resolve partial output before rerunning.

Prove the Factory batch with six synthetic rowsDocxForge Pro 7 days free on the 3-month plan, then $38 every 3 months • 14-day refund after purchase
Many Excel rowsOne standard templateSeparate output filesDOCX + optional PDF
Start Free 7-Day Trial