Quote:
Originally Posted by Guessed
I would set up the document so that the title of the CC is the same as the bookmark name. Then you wouldn't need a massive series of code to deal with every specific pairing of CC to bookmarked range.
Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
Dim sName As String, lColour As Long
If aCC.Type = wdContentControlCheckBox Then
If aCC.Checked Then
lColour = wdYellow
Else
lColour = wdNoHighlight
End If
sName = Replace(aCC.Title, " ", "") 'bookmark names can't have spaces
If ActiveDocument.Bookmarks.Exists(sName) Then
ActiveDocument.Bookmarks(sName).Range.HighlightColorIndex = lColour
End If
End If
End Sub
|
Work like a charm! Thank you very much!