I want to conditionally create multiple MS Word documents based on the same master MS Word document.

I have a single MS Word document with say 100 sections. I want to create 4 different MS Word documents, which include a different subset of the sections from the master document. I know I can do this today by manually copying and pasting, but this is error prone and time consuming. I am looking for a solution where I can somehow tag the different sections in the master document and then somehow provide a parameter value which indicates which sections (based on their associated tags) should be stripped and which should be kept in the resultant document. I experimented with the MS WORD mail merge feature - but it's insuffience to archieve the above result.
Please let me know if the above can be achieved with the vanilla MS WORD product, and if not what commerical Word add-ons do you recommend

Re: Visual Studio Tools for Office Conditionally create multiple MS Word documents based on a single, master MS Word doc?


My organization has recently looked at a commercial product called SmartDocs which facilitates the reuse of content within MS Word. One of the features of SmartDocs is called conditional text which sounds like exactly what you are looking for.

Here is a link to their product:


Re: Visual Studio Tools for Office Conditionally create multiple MS Word documents based on a single, master MS Word doc?

Cindy Meister

There are indeed various approaches that can be used to generate documents from multiple, other documents, or parts of other documents. This, however, is not the correct venue to discuss it, as it's not related to the VSTO technology. You'll find a large number of Word-related newsgroups where you should be able to get a useful discussion, I recommend word.docmanagement (for discussion about Word's capabilities) with a cross-post to word.vba.general (for the parts about the object model). In all cases, no matter where you post, don't forget to mention the version of Word you're targeting.

FWIW, the most basic approach is to mark each "section" with a bookmark. You can then use InsertFile method and pick up the bookmark to bring across just the contents of the bookmark. (Or you can go the other way around and delete the bookmarks out of a document). Mail merge can do something like this, as well, if you use an IncludeText field to choose which bookmarks you want to pick up based on information in the database. Lots of possibilities...