View Single Post
 
Old 12-11-2014, 11:14 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

You cannot embolden only the word BOLD in a dropdown form field, unless you convert the field result to plain text (whereupon it will no longer be a form field). You can however embolden the whole field range if the dropdown result contains the world BOLD e.g.

Code:
Public Sub Test1()
Dim bProtected As Boolean
Dim oFld As FormField
    If ActiveDocument.ProtectionType <> wdNoProtection Then
        bProtected = True
        ActiveDocument.Unprotect Password:=""
    End If
    With ActiveDocument.Content.Find
        .Text = "BOLD"
        .MatchWildcards = True
        .MatchCase = True
        .Replacement.Font.Bold = True
        .Execute Replace:=wdReplaceAll
    End With
    For Each oFld In ActiveDocument.FormFields
        If InStr(1, oFld.Result, "BOLD") > 0 Then
            oFld.Range.Font.Bold = True
        Else
            oFld.Range.Font.Bold = False
        End If
    Next oFld
    If bProtected = True Then
        ActiveDocument.Protect _
                Type:=wdAllowOnlyFormFields, _
                NoReset:=True, _
                Password:=""
    End If
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