+ Reply to Thread
Results 1 to 6 of 6

Thread: Conditional Format drop-down box

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    Conditional Format drop-down box

    Hi,

    I have a drop down box in word 2010 with the options "YES", "NO" and "N/A". I want to have conditional formatting for different color & font depending which is chose. e.g:

    Yes = green
    No = bold & red
    N/A = gray

    is there a way to do this?

    Thanks in advance.
    Last edited by omarq; 01-30-2012 at 06:45 AM.

  2. #2
    Forum Contributor
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    115

    Re: Conditional Format drop-down box

    Hi omarq,

    You could do that via an 'on exit' macro attached to the formfield and coded as:
    Sub ConditionalFormat()
    With ActiveDocument.FormFields("Dropdown1")
        .Range.Font.Bold = False
      If .Result = "Yes" Then
        .Range.Font.ColorIndex = wdGreen
      ElseIf .Result = "No" Then
        .Range.Font.ColorIndex = wdRed
        .Range.Font.Bold = True
      ElseIf .Result = "N/A" Then
        .Range.Font.ColorIndex = wdGray50
      Else
        .Range.Font.ColorIndex = wdAuto
      End If
    End With
    End Sub
    where 'Dropdown1' is the formfield's internal bookmark name.
    Last edited by macropod; 01-31-2012 at 05:23 AM. Reason: Corrected code for Dropdown with 3 options
    Cheers,
    Paul Edstein
    [MS MVP - Word]

  3. #3
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: Conditional Format drop-down box

    Thanks. I can't seem to get that working. Nothing seems to happen when i click and exit the form...

  4. #4
    Forum Contributor
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    115

    Re: Conditional Format drop-down box

    Is this for a dropdown formfield, or something else? If not for a dropdown formfield, then what?
    Cheers,
    Paul Edstein
    [MS MVP - Word]

  5. #5
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: Conditional Format drop-down box

    Ahh.. yes, sorry i was using a combobox. is it possible to do with that in word 2010?

    thanks

  6. #6
    Forum Contributor
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    115

    Re: Conditional Format drop-down box

    You can't apply different colors to your different combobox entries - they must all be the same color. Document content can be any color.
    Cheers,
    Paul Edstein
    [MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0