Try placing the line Selection.Find.Replacement.Font.Bold = True before Selection.Find.Execute Replace:=wdReplaceAll.
Worb VBA multiple find and replace at once - Not getting Bold text in output
Hi
Below Word vba code is working good But the issue is i did not get bold text after replacement. Please help me
Sub PROSECLOCATIONS()
Dim strFind As String, strReplace As String
Dim strFindArr, strReplaceArr
Dim I As Long
strFind = "INBLOCK,ESTS20FT,MCC05,UDDS,UDDN,UDDN05,VEGYARD,COUYARD,DEBOER,CCC,UDD01G2,GISLAND,DOLLY,PAXQRT,PAX QRT,UNMANIFESTED ULD,UNMANIFESTEDULD,AVIFACILITY"
strReplace = "INBLOCK,ESTS-20FT,MCC-05,UDD-S,UDD-N,UDD-N05,VEG YARD,COU YARD,DEBOER,CCC,UDD01G2,GISLAND,DOLLY,PAX QRT,PAX QRT,UNMANIFESTED ULD,UNMANIFESTED ULD,AVI FACILITY"
strFindArr = Split(strFind, ",")
strReplaceArr = Split(strReplace, ",")
For I = 0 To UBound(strFindArr)
Selection.HomeKey Unit:=wdStory, Extend:=wdMove
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = strFindArr(I)
.Replacement.Text = strReplaceArr(I)
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
Next
End Sub