Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2014, 03:46 AM
macropod's Avatar
macropod macropod is offline Conditional Formatting on Word (Dropdown List) Windows 7 64bit Conditional Formatting on Word (Dropdown List) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


The problem was that you'd deleted the placeholder text for the two date controls. The following macro will fix that:
Code:
Sub FixDateCtrls()
With ActiveDocument.SelectContentControlsByTitle("Select Date")
  .Item(1).SetPlaceholderText Text:="Select Date"
  .Item(2).SetPlaceholderText Text:="Select Date"
End With
End Sub
With the ContentControlOnExit macro itself, it seems you haven't really understood how it works. You really don't need to include all of "Dropdown1", "Date1", "Text1", "Select", "Select Date" for the Title selection when you're only concerned with "Select" & "Select Date". Furthermore, when testing the content control's display, you don't need to test all of .PlaceholderText, "n/a", "Choose an Item", "If Yes, Select", "Select Date", when "Choose an Item" & "Select Date" (after running the above macro) are themselves the Placeholder text.

Try the following:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
With CCtrl
  Select Case .Title
    Case "Select"
      Select Case .Range.Text
        Case .PlaceholderText, "n/a", "If Yes, Select"
          .Range.Font.ColorIndex = wdRed
        Case Else
        .Range.Font.ColorIndex = wdAuto
      End Select
    Case "Select Date"
      Select Case .Range.Text
        Case .PlaceholderText
          .Range.Font.ColorIndex = wdRed
        Case Else
        .Range.Font.ColorIndex = wdAuto
      End Select
      With .Range.Font
        .Size = 8
        .Italic = True
      End With
    Case Else
  End Select
End With
Application.ScreenUpdating = True
End Sub
Note how I have separate processes for the 'Select' & 'Select Date' controls. That basically comes down to the latter using italics and to coerce it to remain at 8pt when displaying the Placeholder text - which wouldn't be necessary if you used a Style with those attributes.

You might also want to set each content control's 'cannot be deleted' property, to guard against errant users.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
color, conditional formatting, list



Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting on Word (Dropdown List) Conditionally Color Formatting Text selected from a dropdown list in Word 2010 pgammag Word 9 08-20-2019 04:17 PM
Dropdown conditional formatting tlkc67 Word VBA 6 10-05-2014 10:54 AM
Conditional Formatting on Word (Dropdown List) Conditional formatting that ignores other formatting rules info_guy2 Excel 1 07-03-2014 10:07 AM
Dropdown List in Microsoft Word 2010 bfarquhar Word 2 04-02-2014 07:48 PM
Conditional Formatting on Word (Dropdown List) link conditional info in word based on excel list stijnvanhoof Mail Merge 1 11-13-2012 01:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:26 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