In my ContentControlOnExit event, I can update the contentControl (a Dropdown Box in my scase) font color of the contentcontrol that is triggering the event like this without any issues like this:
Code:
ContentControl.Range.Font.TextColor = RGB(255, 165, 0) 'Orange
However, if I try to update a DIFFERENT ContentControl in the document (not the one triggering the event), the .Font property is not found. Here is my code:
Code:
ActiveDocument.SelectContentControlsByTitle("passfail").Item(1).Range.Font.ColorIndex = RGB(255, 165, 0)'Orange
I get an error: 5843 "One of the values passed to this method or property is out of range".
I can set the text of the control without any issues like this:
Code:
ActiveDocument.SelectContentControlsByTitle("passfail").Item(1).Range
So I know the object is good up until the .Font property. It's the .Font property that is failing.
Basically, I have a compliance review document that has scoring in other drop-down boxes. When the user is done with the scoring, I am adding up the score and setting a dropdown box with "Passed", "Needs Improvement", or "Faile" And I want to update the color of tha dropdown to Green/Orange/Red accordingly.
I can update the font color of other dropdown boxes WHEN the ContentControlOnExit is triggered for THAT dropdown box without any issues. It's just when I try to update the font color of a DIFFERENT Dropdown box on the document that is not the active control.
What am I doing wrong?