A family of Microsoft word processing software products for creating web, email, and print documents.
Hi Steve8d,
Thanks for visiting Microsoft Community.
The purpose of the code you provided seems to be to find text that matches a specific pattern (i.e., numbers starting with a dollar sign) in the selected part of a Word document and set its font size to 14, make it bold, red, and highlighted. To make it only apply to text with a font size of 14, you can add a check for the font size in the find and replace section. Here is the modified code:
Sub Australia_Dollar_Highlight()
Options.DefaultHighlightColorIndex = wdYellow
With Selection.Find
.ClearFormatting
.Text = "($[0-9,]{1,})"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Font.Size = 14
With .Replacement
.Text = "\1"
.ClearFormatting
With .Font
.Size = 14
.Bold = True
.Color = wdColorRed
End With
.Highlight = True
End With
.Execute Replace:=wdReplaceAll
End With
End Sub
Here are the test results.
You need to select the text you want to format before running the code.
If you have any issues, please feel free to reply.
Best Regards,
Jonathan Z - MSFT | Microsoft Community Support Specialist