Replace Mail Merge Data Source Header for Word docs
Posted on 2010-09-20
Hello, I have a client with several hundred Word Mail Merge documents that we've migrated to a different system. All of these documents have incorrect data header sources and need to be pointed to a new source. I already know how to open the Word docs one by one and replace the header source. But this is very time consuming and is confusing users. I want to know how to programmatically replace the header source on Word docs.
My source document is an Access database .mdb file stored on the C:\ drive. I prefer to point each mail merge to this .mdb file. All data is stored on SQL Server 2008 though, so I would entertain the idea of using other data source types to connect (i.e. DSN's, etc.). Again, I can successfully open and connect to my data source .mdb or using DSN but I need a way to convert a bunch of Word files at once so that I don't have to open and save each one by hand.
Also, when I open a Word file and it can't find the old data source, it pops up with a "Data Link Properties" window. I can then point to my Access database and it connects/merges fine, but for some stupid reason I can't SAVE this to the document. When I save the window just pops up again and when I resave, close and reopen it keeps popping up. I have to manually remove the header/source in order for it to save changes. Very frustrating and time consuming.