SQL Server Mail Merge With VSTO RRS feed

  • Question

  • I am using a SQL Server data source to perform a mail merge on a document. The problem is the mail merge occurs for all records. Is there anyway to filter the data that is included in the mail merge via VSTO?


    Monday, April 22, 2013 2:57 PM


  • The VSTO technology has nothing specific as far as Word's built-in mail merge feature goes.

    The Word APIs (object model/interop) does have properties and methods for working with mail merge that reflect the capabilities in the user interface. Two are relevant for limiting which records are merged: a "checkbox" type of filter that can select individual records and creating a standard SQL-Type query.

    Your other option would be to create stored procedures on SQL server and link the mail merge document to that, rather than an entire table.

    Cindy Meister, VSTO/Word MVP, my blog

    Monday, April 22, 2013 3:28 PM