![]() |
|
#2
|
||||
|
||||
|
You were almost there. Two things:
- Capitalisation is important. If you don't match the same capitalisation then your code would fail. I've added the UCase to your code to avoid this problem - You need to specify the RANGE where you want to colour the font. This code now colours the entire cell's range but you may have been happy just doing the range of the Content Control (in which case .Font.Color = wdColorRed would have been enough Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
If UCase(ContentControl.Title) = "ACTION" Then
With ContentControl.Range
Select Case UCase(.Text)
Case "URGENT"
.Cells(1).Range.Font.Color = wdColorRed
Case "FOLLOW"
.Cells(1).Range.Font.Color = wdColorOrange
Case "INFORMATION"
.Cells(1).Range.Font.Color = wdColorGreen
End Select
End With
End If
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to get a Drop Down List Content Control box to fill in other areas
|
snips1982 | Word | 2 | 03-22-2017 03:37 AM |
| Populate Drop-Down Content Control from CustomXMLPart added to the Document | KhmerBoi1 | Word VBA | 0 | 05-11-2016 01:10 PM |
Is there a way to anchor drop-down content control boxes so entering text doesn't change formatting?
|
TzarChasm | Word | 7 | 04-14-2016 06:28 PM |
| Word drop-down content control dependent display issue | vvcat | Word | 6 | 02-03-2015 11:20 PM |
Deleting a table from a content control -- preserving the content control
|
BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |