View Single Post
 
Old 05-21-2018, 07:56 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If there is more than one control in the document then it must be limited to the control either by checking against the current control's title or tag. It is also advisable to check whether the control is showing the placeholder text e.g.


Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
    With CCtrl
        If CCtrl.Title = "Names" Then    'the name of the control
            If CCtrl.ShowingPlaceholderText = False Then
                .Type = wdContentControlRichText
                .Range.Font.Bold = False
                .Range.Words.First.Font.Bold = True
                .Type = wdContentControlDropdownList
            Else
                .Range.Font.Bold = False
            End If
        End If
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote