none
Using Word as the datasource for Word MailMerge RRS feed

  • Question

  • I have word documents that have VBA code to do mailmerge using Access as the source. I use a shortcut key, the code prompts for a item number, the item number is used in a query against the database and then the mailmerge object creates the letters. It works perfectly. 

    I am moving my Access database into Azure SQL Server, only to discover that I can't just simply repoint my VBA to the online database. Of course, that would be too easy. AHHH! 

    My current new idea is to use ADO to query the online database and return the results as a recordset. Dump the results to a temporary file and use that as the datasource for my mailmerge. I was in the middle of using a tab delimited text file for the source when I ran across a scantly detailed web posting about using a temporary word table as the datasource. 

    The word idea sounds better than what I'm trying to do. I already have the Word application open when this code is running. I'm using VBA in word. Why not also have word as the temporary datasource. 

    BUT..that's as far as I've gotten. It sounds great if I knew how to make it work. 

    Can somebody run me through a quick summary of how to do what I've described, hopefully with some code to go with it?

    tod

    Wednesday, November 16, 2016 4:04 AM