![]() |
#2
|
||||
|
||||
![]()
The following macro assumes you're using a Checkbox Content Control titled 'Checkbox1' and, for the text to be shown/hidden, a Rich Text Content Control titled 'ConditionalText':
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean) With CCtrl Select Case .Title Case "Checkbox1" ActiveDocument.SelectContentControlsByTitle("ConditionalText")(1).Range.Font.Hidden = Not .Checked End Select End With End Sub With the checkbox checked, the content will be formatted as visible; unchecked, hidden. To reverse the options, delete the 'Not' from the code. Do note that whether text formatted as hidden will remain visible - or even be printed if not visible - depends on how the user has their Word installation configured.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
philip.anthony | Word VBA | 11 | 03-28-2022 02:15 PM |
![]() |
silverspr | Word VBA | 9 | 09-30-2020 07:53 AM |
How to display tag in Content Control instead of title | vinbalraj | Word | 1 | 03-02-2018 08:55 AM |
![]() |
Curby | Word | 2 | 06-30-2016 12:29 AM |
Help with show/hide content control | acontreras | Word VBA | 0 | 10-21-2014 07:28 PM |