Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-20-2021, 01:59 PM
GoChatter GoChatter is offline How to change VB code so dropdown conditional format color changes to "wdLightOrange" Windows XP How to change VB code so dropdown conditional format color changes to "wdLightOrange" Office 2016
Novice
How to change VB code so dropdown conditional format color changes to "wdLightOrange"
 
Join Date: Apr 2021
Posts: 2
GoChatter is on a distinguished road
Question 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
In Paul's document, I successfully changed the Low from "wdBrighGreen" to "wdYellow" but when I try to replace the Medium from "wdYellow" to "wdLightOrange", it breaks the code. The following text is highlighted in bright yellow with an arrow next to it): "Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)"

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
Reply With Quote
 



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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft