logo
search
VBA & Macro Problems

How to Find Text with a 14-Point Font Using Word VBA

Maira MehtabMaira Mehtab Sep 27, 2026 869 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Clear existing find formatting

In your macro code, type 'Selection.Find.ClearFormatting' to reset the search tool and prevent conflicts with prior find actions.

2
Set search text and wildcard options

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.

3
Specify the exact font size

Target the exact font size by adding 'Selection.Find.Font.Size = 14' to your script.

4
Set replacement formatting

Use 'Selection.Find.Replacement.ClearFormatting' followed by your desired replacement formatting, such as 'Selection.Find.Replacement.Font.Bold = True'.

5
Execute the find and replace command

Run the replacement loop by executing 'Selection.Find.Execute Replace:=wdReplaceAll' to apply the changes across the selected range.

Enable Formatted Searching: Make sure your search format flag is enabled in the code by setting 'Selection.Find.Format = True' so Word knows to look for the font size criteria.
Advanced Document Formatting

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. 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. 2. Access advanced search settings: Click on the 'Options' or 'More' button to expand the advanced search settings menu.
  3. 3. Set the search font format: Click the 'Format' drop-down button at the bottom of the window and select 'Font'.
  4. 4. Specify 14-point size: In the Font dialog, select '14' in the Size list and click 'OK'.
  5. 5. Execute the replacement: Enter your new formatting or text in the 'Replace with' box, then click 'Replace All' to update the document.
Fully compatible with Microsoft Word .docx formatsAdvanced Find and Replace natively supports font size, color, and style matchingLightweight application with a clean, familiar interfaceNo coding required for complex formatting searches
microsoft office alternative - wps office

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.