![]() |
#6
|
|||
|
|||
![]()
This seems a convoluted process but yes it is certainly possible. See attached document and image.
You will need to create the three different conditions 0) a rich text cc (Titled Result) with both check boxes and text showing 1) a richtext CC (Titled Result1) with Checkbox1 and text only 2) a rich text CC (Titled Result2) with Checkbox 2 and text only and an overall result richtext CC (titled Result) showing both checkboxes and text. These will have to be mapped to a customXMLpart. Once done, you can remove the Result0, Result1 and Result2 richtext CCs and content. You will need the following code in the ThisDocument class object: Code:
Private Sub Document_ContentControlBeforeStoreUpdate(ByVal CC As ContentControl, Content As String) Select Case CC.Title Case "Checkbox1" 'Reset so Result CC shows both checkboxes and paragraphs (Result0 node value) CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result[1]").Text = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result0[1]").Text If CC.Checked Then 'Remap Result CC to show only checkbox 1 and text (Result1 node value) CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result[1]").Text = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result1[1]").Text End If Case "Checkbox2" 'Reset so Result CC shows both checkboxes and paragraphs (Result0 node value) CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result[1]").Text = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result0[1]").Text 'Remap Result CC to show only checkbox 2 and text (Result2 node value) If CC.Checked Then CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result[1]").Text = CC.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:Result2[1]").Text End If End Select End Sub Last edited by Charles Kenyon; 11-13-2020 at 11:55 AM. Reason: make list more readable |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Inserting text from a Userform into a Field in a paragraph in a paragraph in a word document | storemaz | Word VBA | 1 | 03-13-2020 08:11 AM |
![]() |
francescof | Word | 2 | 03-27-2019 01:35 AM |
Hide and display pictures | Ljungwe | Drawing and Graphics | 1 | 04-26-2018 04:46 AM |
![]() |
turnquistcm | Word | 2 | 05-03-2017 07:05 PM |
![]() |
Curby | Word | 2 | 06-30-2016 12:29 AM |