View Single Post
 
Old 04-01-2022, 07:05 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
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

I wouldn't do this with collapsed subheadings. Instead I would place the subquestions into a rich text Content Control and then hide/show that range according to the answer they give. This code and attached document shows how I've made it so you don't need to edit the code to add more sections - just set up the CC title or tag properties in matching pairs.
Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
  Dim aCCont As ContentControl
  If aCC.Tag = "Has Subquestions" Then
    For Each aCCont In ActiveDocument.SelectContentControlsByTitle(aCC.Title & " Subquestions")
      aCCont.Range.Font.Hidden = Not aCC.Checked
    Next aCCont
  End If
End Sub
Attached Files
File Type: docm Demonstration.docm (33.0 KB, 10 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote