![]() |
|
#1
|
|||
|
|||
|
I'm trying to create a document in Word 2016 that will allow a user to have the ability to check a checkbox to make specific bookmarked text content appear within the document and to disappear when unchecked. I have tried two different sets of VBA code while using an ActiveX Control type checkbox for the UI but nothing is working. To bookmark a set of text, I highlighted the text that I want and added a bookmark named "Bookmark1". I am not a programmer by any means. What am I missing or what can i do to accomplish what I want? I'm trying to do this for multiple checkboxes and bookmarks. Thanks. Set 1: Code:
Private Sub CheckBox1_Click()
If Bookmarks("Bookmark1").Range.Font.Hidden = True Then
Bookmarks("Bookmark1).Range.Font.Hidden = False
Else
Bookmarks("Bookmark1).Range.Font.Hidden = True
End If
End Sub
Code:
Private Sub CheckBox1_Click()
Dim ShowText As Range
Dim HideText As Range
Set ShowText = ActiveDocument.Bookmarks("Bookmark1").Range
Set HideText = ActiveDocument.Bookmarks("Bookmark1").Range
If CheckBox1.Value = True Then
ShowText.Font.Hidden = False
HideText.Font.Hidden = True
Else
ShowText.Font.Hidden = True
HideText.Font.Hidden = False
End If
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hide rows with checkbox | gebobs | Excel | 3 | 03-24-2015 12:05 PM |
| Show/hide text macro and security issues? | subspace3 | Word VBA | 1 | 10-05-2014 10:05 AM |
Show/Hide Text based on Checkbox Selection
|
tammytran105 | Word VBA | 7 | 10-02-2014 04:30 PM |
Hide Checkbox When Printing
|
vinceplunkett | Word | 1 | 12-03-2013 01:53 AM |
VBA for CheckBox to Hide Slides
|
mutchy25 | PowerPoint | 1 | 09-21-2012 01:40 AM |