![]() |
|
#1
|
||||
|
||||
![]()
Setting the background colour relies heavily on the pattern you have applied to the cell. It would be simpler to set the foreground colour instead. Since the code chooses the cell based on the location of the CC, you can treat both CCs the same way
Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean) Dim StrPwd As String, iCol As Long StrPwd = "DocumentPassword" With aCC Select Case .Title Case "Lst1", "Lst2" 'MsgBox .Range.Text Select Case .Range.Text Case "High" iCol = wdRed Case "Medium" iCol = wdYellow Case "Low" iCol = wdBrightGreen Case Else iCol = wdWhite End Select If ActiveDocument.ProtectionType <> wdNoProtection Then ActiveDocument.Unprotect Password:=StrPwd .Range.Cells(1).Shading.ForegroundPatternColorIndex = iCol ActiveDocument.Protect wdAllowOnlyFormFields, True, StrPwd End Select End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]()
Thank you, Guessed, for your help. This code is more streamlined, and I tried to run it, but the cells were still not colored in the table. I am not sure why. I have attached a sample document in response to macropod's request. If you can take a look and offer any suggestions I'd very much appreciate your time and effort.
|
![]() |
Tags |
color, dropdown, reaction |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
block selection in dropdown list | Intruder | Excel | 2 | 01-10-2013 10:20 AM |
![]() |
coconutt | Word VBA | 5 | 09-13-2012 05:23 PM |
![]() |
fedcco | Excel | 12 | 08-28-2012 10:43 PM |
![]() |
biffle0764 | Word | 2 | 05-09-2012 12:54 PM |
Change cell color everytime a value is selected in dropdown list | angelica_gloria | Excel | 4 | 01-27-2012 06:47 PM |