View Single Post
 
Old 07-30-2018, 02:40 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Quote:
Originally Posted by gmayor View Post
Youi cannot format a content control dropdown list in this manner.
Au contraire, assuming the content control is given the tag 'Dropdown' :
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim strTxt As String, Rng As Range
With CCtrl
  If .Tag <> "Dropdown" Then Exit Sub
  If .ShowingPlaceholderText = True Then
    .Range.Font.StrikeThrough = False
    .Range.Font.Bold = False
    Exit Sub
  End If
  strTxt = .Range.Text
  If InStr(strTxt, "\") > 0 Then Exit Sub
  .Type = wdContentControlRichText
  .Range.Font.StrikeThrough = False
  .Range.Font.Bold = False
  With .Range
    .Text = "High\Significant\Low"
    .Font.StrikeThrough = True
    Set Rng = .Duplicate
    With Rng
      .End = .Start + InStr(.Text, "\")
      .Start = .End - 1
      .Font.StrikeThrough = False
    End With
    Set Rng = .Duplicate
    With Rng
      .End = .Start + InStrRev(.Text, "\")
      .Start = .End - 1
      .Font.StrikeThrough = False
    End With
    Set Rng = .Duplicate
    With Rng
      .Start = .Start + InStr(.Text, strTxt) - 1
      If InStr(.Text, "\") > 1 Then .End = .Start + InStr(.Text, "\") - 1
      .Font.StrikeThrough = False
      .Font.Bold = True
    End With
  End With
  .Type = wdContentControlDropdownList
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 07-30-2018 at 03:20 AM. Reason: Updated code
Reply With Quote