#1
|
|||
|
|||
Change colours in different tables based on dropdown selections
Split from: https://www.msofficeforums.com/word-...wn-choice.html
PLeo -- I'm trying to do something very similar but it's not working for me. Can you provide the updated file with the working macro? Thanks! Last edited by macropod; 08-03-2017 at 03:37 PM. Reason: New topic split to new thread |
#2
|
|||
|
|||
New file
kevinbradley57,
Here's the working file. Hope it helps. |
#3
|
|||
|
|||
It works -- thank you, Macropod and PLeo!
|
#4
|
|||
|
|||
Quote:
My file is attached. |
#5
|
||||
|
||||
Try:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) With ContentControl Select Case .Title Case "Rating" Select Case .Range.Text Case "Unsatisfactory": .Range.Cells(1).Shading.BackgroundPatternColor = 4739264 Case "Satisfactory With Improvements Needed": .Range.Cells(1).Shading.BackgroundPatternColor = 5232127 Case "Satisfactory": .Range.Cells(1).Shading.BackgroundPatternColor = 5880731 Case Else: .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdNoHighlight End Select Case "Risk" Select Case .Range.Text Case "High": .Range.Cells(1).Shading.BackgroundPatternColor = 4739264 Case "Moderate": .Range.Cells(1).Shading.BackgroundPatternColor = 5232127 Case "Low": .Range.Cells(1).Shading.BackgroundPatternColor = 5880731 Case Else: .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdNoHighlight End Select Case Else End Select End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Quote:
|
#7
|
||||
|
||||
It works for me. Did you exit the content control?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Paul - It works. I must have copied/pasted an extra something the first time. Thanks so much! You have saved me many hours and much frustration.
|
#9
|
|||
|
|||
Paul -- Can you show me how to change the font color to white when the text = "High"?
Case "Risk" Select Case .Range.Text Case "High": .Range.Cells(1).Shading.BackgroundPatternColor = 4739264 Case "Moderate": .Range.Cells(1).Shading.BackgroundPatternColor = 5232127 Case "Low": .Range.Cells(1).Shading.BackgroundPatternColor = 5880731 Case Else: .Range.Cells(1).Shading.BackgroundPatternColorInde x = wdNoHighlight End Select |
#10
|
||||
|
||||
You could use:
Code:
Case "High": .Range.Cells(1).Shading.BackgroundPatternColor = 4739264: .Range.Cells(1).Range.Font.ColorIndex = wdWhite
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Perfect. Thanks!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with Hide/Display of sections of document based on Drop Down selections | turnquistcm | Word | 2 | 05-03-2017 07:05 PM |
Best way to load data into a template based on user selections | Timbo | Word | 1 | 11-07-2013 05:14 AM |
Contact details entered based on multiple drop down selections | ntropey87 | Word VBA | 4 | 04-20-2013 11:19 AM |
add values to dropdown selections and calculate | guyhs | Word | 7 | 10-24-2012 05:11 PM |
Template: group dropdown selections | mfoe33 | Word | 0 | 10-15-2012 02:58 AM |