Fix a Word VBA Mail Merge Macro That Stops Running
Question details
The user needs a reliable way to create individual PDF mail-merge files from an Excel data source after a Word VBA macro stops running midway.

- Product
- Microsoft Word VBA mail merge
- Device & OS
- not provided
- Scenario
- The user is running a Word VBA macro that selects a workbook and table to produce individual PDF mail-merge files.
- Observed behavior
- The macro stops after the workbook and table are selected, and the code contains inconsistent variable names.
Open the mail merge main document and confirm it is a Letters-type document. Also check the Excel data source so field names are valid, unique, alphanumeric, and placed in the first row.
Use the Merge Tools Add-in to Create Individual PDF Mail-Merge Files
Use this when you need a working mail merge without debugging VBA; the add-in creates individual Word or PDF files, names them from data fields, and can send email attachments.
The Merge Tools Add-in handles the record-splitting and PDF export tasks that the failing macro attempted. Download it from the linked OneDrive location and follow the included setup guide.
Download the Merge Tools Add-in from the linked OneDrive location, open the setup guide, and install it in Microsoft Word.
Open the mail merge main document in Word and confirm it uses the Letters document type.
Make sure Excel field names are in the first row, contain only alphanumeric characters, do not begin with a number, are no longer than 40 characters, and are unique.
Select the workbook and table in Merge Tools, choose individual Word or PDF output, and set the file naming field from the data source.
Run the merge and verify that each record produces a separate file, then use the email option if attachments are required.

Repair Inconsistent VBA Variable Names in the Mail Merge Macro
Use this if you prefer to keep the existing Word macro; it fixes the most likely cause of the macro stopping after selecting the workbook and table.
Use WPS Writer as a Free Alternative for Mail Merge Without VBA Headaches
If the Word VBA macro still stops, WPS Office is a free, lightweight Microsoft Office alternative. It opens your existing Word mail merge templates with familiar tools, preserves .docx and .doc compatibility, and helps you move away from fragile VBA mail merge code.

Frequently Asked Questions
Why does a Word VBA mail merge macro stop after selecting the workbook and table?
It usually stops because the VBA code uses inconsistent variable names for the workbook or table. Open the VBA editor with Alt+F11, compare the Dim statements and assignment lines, rename them consistently, and click Debug > Compile VBA Project before running the macro.
What document type is required for mail merge individual PDF output?
The mail merge main document must be a Letters-type document. Check this in Word before running Merge Tools or a VBA mail merge macro.
What are the Excel field name rules for a mail merge data source?
Excel field names must be in the first row, be unique, contain only alphanumeric characters, not begin with a number, and be no longer than 40 characters.
Can I use the Merge Tools Add-in to name individual PDF files from a data field?
Yes. After selecting the workbook and table, choose individual Word or PDF output in Merge Tools and set the file naming field from the Excel data source.
Does WPS Writer support mail merge documents created in Word?
Yes. WPS Writer can open Word .docx and .doc mail merge templates and provides a familiar Mailings workflow for common merge tasks, but Microsoft Word VBA macros may need to be repaired in Word.




