Quote:
Originally Posted by namrehx
Also, How do I do the same thing that the code you provided does but for a whole different set of checkboxes and bookmarks within the same document? For example, I got a CheckBox4, CheckBox5 , and Bookmark3 that's completely separate from the first two checkboxes and bookmark. I'm getting an ambiguous error when trying to do this. I know it's because I'm using the ShowHide method more than once. WHat's the solution?
|
I got the part that I needed help with from the quoted post resolved. But I still need help with making a bookmark to only show when two or more checkboxes are checked while still making all of the functionality we have covered so far to work. In this case, I have Bookmark2 that needs to only show when CheckBox3 is checked along with CheckBox1 and/or CheckBox2. Here is what I have below so far:
Code:
Private Sub CheckBox1_Click()
Call ShowHide
End Sub
Private Sub CheckBox2_Click()
Call ShowHide
End Sub
Private Sub CheckBox4_Click()
Call ShowHide
End Sub
Private Sub CheckBox5_Click()
Call ShowHide
End Sub
Sub ShowHide()
Dim bVis As Boolean: bVis = True
Dim aVis As Boolean: aVis = True
If CheckBox1.Value = True Then bVis = False
If CheckBox2.Value = True Then bVis = False
ActiveDocument.Bookmarks("Bookmark1").Range.Font.Hidden = bVis
If CheckBox4.Value = True Then aVis = False
If CheckBox5.Value = True Then aVis = False
ActiveDocument.Bookmarks("Bookmark3").Range.Font.Hidden = aVis
End Sub