![]() |
#1
|
|||
|
|||
![]()
Hello everyone and thank you very much in advance.
I have formcheckbox next to formtext and I need the last ones to be highlighted when the first ones are checked. I have obtained this code but it gives me an error in a protected area and the forms need protection. How can I do it? Sub CheckBox_Click() Dim ff As FormField Dim rng As Range Set ff = Selection.FormFields(1) 'Assuming the check box is the only form field in the selection Set rng = ff.Range 'The range of the check box rng.MoveEnd wdWord, 1 'Extend the range to include the next word If ff.CheckBox.Value = True Then 'If the check box is checked rng.HighlightColorIndex = wdYellow 'Highlight the range with yellow color Else 'If the check box is unchecked rng.HighlightColorIndex = wdNoHighlight 'Remove the highlight from the range End If End Sub |
Tags |
form controls, formcheckbox, formtext |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Pankaj | Word VBA | 1 | 10-14-2016 03:48 AM |
![]() |
mp04279 | Word | 1 | 02-17-2016 08:16 PM |
![]() |
emwinschuh | Word | 1 | 08-17-2015 08:55 AM |
Macro to find coloured text and replace with form-field/formtext containing that text | tarktran | Word VBA | 1 | 11-26-2014 08:12 AM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |