|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to change VB code so dropdown conditional format color changes to "wdLightOrange"
I am trying to figure out how to insert a dropdown list (Choose Item: High, Medium, low) into a report table in MS Word. I need High to = wdRed, Medium to = wdLightOrange (Hex: #FF9900), and Low to = wdYellow. I found the following code:
in a file named "Content Controls - Dropdown Conditional Format.docm" that I found from the 'macropd' Administrator, Paul Edstein URL: https://www.msofficeforums.com/word-...html#post47254 Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) With ContentControl If Len(.Title) < 4 Then Exit Sub If Left(.Title, 4) = "Risk" Then Select Case .Range.Text Case "High": .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdRed Case "Medium": .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdYellow Case "Low": .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdBrightGreen Case Else: .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdNoHighlight End Select End If End With End Sub What do I need to do to get my table to highlight with Light orange (HEX: #FF9900) when I select the Medium from the form field drop down box? Am attaching the one I downloaded from Paul Edstein and the one I am working on. Last edited by macropod; 04-20-2021 at 02:27 PM. Reason: Added code tags |
#2
|
||||
|
||||
Use:
.BackgroundPatternColor = wdColorLightOrange
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you Paul! Really wish I had some programming knowledge. I have another question... Where should I paste the code? When I look at your document, I only see it in the VBA area; not the Macro area. However when I copy the code and paste it into my word document, nothing happens when I select something from the drop down menu.
I've attached images. |
#4
|
||||
|
||||
Quote:
Macros that take arguments (in this case ByVal ContentControl As ContentControl, and Cancel As Boolean) are not accessible via the GUI.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conditional Formatting date change "Y" | lolla70 | Excel Programming | 3 | 04-24-2019 11:13 AM |
Need help with conditional formatting & returning "Pass" / "Fail Results" in a Column N | mikey386 | Excel | 2 | 12-11-2014 01:14 PM |
Change "File As" and "Display As" format | davesp | Outlook | 0 | 10-14-2014 12:10 PM |
Is there a way to change "Genesis" Theme Color from Blue to Green | FUNKSTICK | PowerPoint | 13 | 03-12-2014 12:29 AM |
How to globally change default "pattern fill" color for all shapes in PP 2013 | tbach | PowerPoint | 1 | 01-31-2014 10:59 AM |