![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Please be kind as I am very new to document controls and have never used VBA until now. I also am not able to upload an example document because of test security requirements.
I am a school psychologist and have to write psychological evaluation reports after I finish testing a student that include all of the information/scores from the evaluations. I have a template document that includes multiple different types of content controls (text, dropdown lists, .... and checkboxes). At the beginning of the report, I have a list of all the different tests I give with checkboxes next to each one. I tagged each checkbox with the specific test name (for example "Assessment1"). At the end of the report I have a bunch of tables where I input different test scores. Each table is also saved as a bookmark. The bookmark tag matches a tag on one of the checkboxes. (so I have a checkbox tagged as "Assessment 1" and a bookmark tagged as "Assessment 1". I want to make it so if the checkbox is not checked, the bookmark will be hidden (only show the text for the tests that I am using). After looking online, I pasted the following into the Visual Basic under content control on exit: (Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) If ContentControl.Tag <> "" Then ActiveDocument.Bookmarks(ContentControl.Tag).Range .Font.Hidden = Not ContentControl.Checked End If End Sub This works; however, now when I click out of any of content controls that are not checkboxes, I get an error message that says "Run-time error '6290': This property is only available for checkbox content controls." I have been playing with this for about 3 hours and cannot find anything on how to fix this. Please help! |
Tags |
contentcontrols, vba code, vba content control |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to hide and show a tabel using bookmark and checkbox | Rikke | Word VBA | 5 | 05-01-2024 07:43 AM |
Hiding rich text content control using checkbox - Removing extra spacing | TheOstrich | Word VBA | 4 | 11-15-2023 11:58 AM |
Checkbox - toggle hide/unhide other checkbox - XMLMapping | GErl | Word VBA | 9 | 11-19-2020 03:15 PM |
Bookmark will not show/hide based on CC Checkbox | lord_kaiser | Word VBA | 1 | 04-17-2018 01:19 AM |
![]() |
tammytran105 | Word VBA | 7 | 10-02-2014 04:30 PM |