Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-01-2022, 07:05 PM
Guessed's Avatar
Guessed Guessed is offline Script to delete ContentControl Checkboxes by Tag if a specific Checkbox is checked Windows 10 Script to delete ContentControl Checkboxes by Tag if a specific Checkbox is checked Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
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
 

Tags
checkboxes, contentcontrols



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide one bookmark when Two checkboxes are checked AVarg123 Word VBA 4 04-01-2022 06:21 PM
Add / Sum checked Checkboxes labelled 1, 2, 3, etc. in Word Table - Need Macro? klearazkrystal Word VBA 7 03-31-2019 11:50 PM
Need Macro to select Checkbox after two boxes are checked in a series of checkboxes rsaini Word VBA 0 01-16-2018 11:57 AM
Wanting to use checkboxes etc in a TOC to delete specific pages in a 300 page document Tammy Word 4 10-11-2016 05:53 PM
Checkboxes are unchecked in Listbox that were checked off before.How can I stop this? Rochelle711 Excel Programming 0 06-22-2014 06:16 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft