How to Automatically Handle Word Mail Merge Data Source Prompts with VBA
Question details
The user wants to find a way to bypass or automatically manage the default SQL prompt that appears when opening a mail merge template, ensuring the data source reconnects seamlessly.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Opening a saved mail merge template that is linked to a spreadsheet data source.
- Observed behavior
- Word displays a prompt asking users whether to reconnect to the spreadsheet data source. If users select 'No', the connection is dropped and the data source information is lost.
Ensure you have administrative privileges to access the Word Startup folder, and only install VBA macros or templates from trusted sources to prevent security risks.
Install the Merge SQL Message Eliminator Add-in
Use a VBA-powered Word add-in template to store data source details and provide controlled connection options when reopening mail merge documents.
By utilizing a dedicated VBA add-in, you can bypass the default Microsoft Word SQL prompt. The add-in works by saving the data source variables directly into the document when you close it, allowing for automatic reconnection prompts upon reopening.
Open Windows File Explorer, type '%appdata%\Microsoft\Word\Startup' into the address bar, and press Enter to open the folder.
Place your downloaded 'MergeSQLMessageEliminator.dotm' file into this Startup folder so it loads automatically when Word starts.
Perform your mail merge setup as usual. When closing the document, a dialog will appear from the add-in; click 'OK' to save the data source variables securely into the document.
When you reopen the document, a custom message box will appear. Click 'OK' to reattach the existing data source automatically, or click 'Cancel' to open the document without it and attach a new spreadsheet.

Experience Seamless Mail Merge with WPS Office
Tired of dealing with complex VBA add-ins and recurring SQL data source prompts in Microsoft Word? WPS Office provides a streamlined, built-in Mail Merge feature that requires no advanced configuration, ensuring your spreadsheets stay seamlessly connected.
- 1. Open WPS Writer: Launch WPS Writer and open your document template.
- 2. Access the Mail Merge Tool: Navigate to the 'References' tab and click on the 'Mail Merge' button.
- 3. Connect Your Spreadsheet: Click 'Open Data Source' to link your spreadsheet. WPS handles the connection securely without repetitive SQL warning prompts.

Frequently Asked Questions
Why does Word ask to reconnect to the data source every time I open a mail merge document?
By default, Microsoft Word displays an SQL security prompt whenever you open a document linked to an external data source. This is a built-in security measure designed to prevent malicious scripts from extracting or modifying data on your computer without your knowledge.
Where is the default Word Startup folder located on Windows?
Unless it has been customized by an IT administrator, the default Word Startup folder on Windows is located at %appdata%\Microsoft\Word\Startup. You can access it easily by pasting this path directly into your Windows File Explorer address bar.
Can I disable the Word SQL data source prompt using the Windows Registry?
Yes, advanced users can disable this prompt globally by adding a 'SQLSecurityCheck' registry key set to 0. However, using a VBA add-in is often safer and more flexible because it provides per-document control without altering system-wide security settings.
Will these VBA macros run automatically?
Macros will only run automatically if your Microsoft Word Trust Center settings allow them. For add-ins placed in the default Startup folder, Word typically treats them as trusted, but you should always verify macro security settings in the Trust Center.




