![]() |
|
#1
|
||||
|
||||
![]() 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
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]() Quote:
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
DEsh | Word VBA | 2 | 10-06-2017 08:23 PM |
![]() |
lukael | Excel Programming | 5 | 02-18-2014 05:20 AM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |
macro on checkbox | macrohelp | Word VBA | 0 | 03-06-2009 03:33 PM |
highlight cell after checkbox | flatk | Word | 0 | 01-25-2007 12:32 PM |