How to Find Text with a 14-Point Font Using Word VBA
Question details
The user wants to know how to create or configure a Word VBA macro to specifically search for text that is formatted with a 14-point font size, enabling them to replace or reformat the matched content.
- Product
- Word
- Device & OS
- not provided
- Scenario
- Writing or troubleshooting a VBA macro to selectively find text based on its font size rather than its textual content.
- Observed behavior
- The user needs to correctly configure the Find formatting parameters and clear existing search rules in the VBA editor to ensure only 14-point text is targeted during execution.
Ensure your document is saved as a macro-enabled format (.docm) and that you have enabled the Developer tab in your Word settings to access the Visual Basic editor.
Configure VBA Find Parameters for Specific Font Size
Use the VBA Find object to clear previous formatting rules and target the exact 14-point font size before executing the replacement.
When using VBA to search for specific text formatting, it is critical to clear any leftover search parameters from previous operations. Failing to clear formatting can lead to the macro replacing incorrect sections of your document.
In your macro code, type 'Selection.Find.ClearFormatting' to reset the search tool and prevent conflicts with prior find actions.
Assign your target string to 'Selection.Find.Text' (leave it blank like "" if you want to find all text) and configure wildcard settings if necessary.
Target the exact font size by adding 'Selection.Find.Font.Size = 14' to your script.
Use 'Selection.Find.Replacement.ClearFormatting' followed by your desired replacement formatting, such as 'Selection.Find.Replacement.Font.Bold = True'.
Run the replacement loop by executing 'Selection.Find.Execute Replace:=wdReplaceAll' to apply the changes across the selected range.
Find and Replace Specific Font Sizes in WPS Writer
You can easily locate and replace text formatted with a 14-point font size in WPS Writer using its built-in Advanced Find and Replace tool, bypassing the need to write any complex VBA code.
- 1. Open Find and Replace: Open your document in WPS Writer and press 'Ctrl + H' on your keyboard to launch the Find and Replace dialog.
- 2. Access advanced search settings: Click on the 'Options' or 'More' button to expand the advanced search settings menu.
- 3. Set the search font format: Click the 'Format' drop-down button at the bottom of the window and select 'Font'.
- 4. Specify 14-point size: In the Font dialog, select '14' in the Size list and click 'OK'.
- 5. Execute the replacement: Enter your new formatting or text in the 'Replace with' box, then click 'Replace All' to update the document.

Frequently Asked Questions
Can I search for multiple font sizes at once using VBA?
No, the standard Selection.Find.Font.Size property only accepts a single numeric value at a time. To find multiple font sizes, you must run the search sequence multiple times or loop through an array of sizes.
Why is my macro replacing text that isn't 14-point font?
This usually happens if you forget to include the Selection.Find.ClearFormatting command before running the macro, which causes Word to remember and use leftover search criteria from your previous manual searches.
Does WPS Office support VBA macros?
Yes, depending on your version and subscription, WPS Office provides excellent VBA (Visual Basic for Applications) support, allowing you to run your existing Word macros with high compatibility.




