View Single Post
 
Old 05-01-2021, 08:02 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Steve

If you've seen many of my posts on this forum, you will know that I often encourage people to use mapped Content Controls instead of more vba intensive methods. In the case of your template, I think that your question can be greatly simplified by using a mapped CC setup that relies on just 4 xml fields.

See the attached doc to see how this concept works. The first table contains mapped CCs which you can populate and you will see that the dependent table CCs all change with the gender since they are all mapped to the same field with common 'value' settings. You can then use these CCs throughout your document and include them in your building blocks to completely do away with the code you are asking about.

Any document you want to apply this solution to will need the embedded XML file but that is a relatively simple step that is taken care of by saving this document as a template or by using vba to create the XML in any already existing document.
Attached Files
File Type: docx SchoolReport_MappedXML_Demo.docx (51.2 KB, 5 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote