How to Use VBA to Bold the Paragraph After a Specific Letter in Word
Question details
The user wants to automate the process of finding a specific letter or character in a document and applying bold formatting to the paragraph immediately following it using VBA.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Automating document formatting for structured text or right-to-left languages based on specific trigger characters.
- Observed behavior
- The user needs a working VBA macro script to achieve conditional bold formatting for paragraphs succeeding a specified target character.
Ensure your document is saved as a Macro-Enabled Document (.docm) to preserve your VBA code. It is also highly recommended to create a backup copy of your document before running new macros to prevent accidental formatting loss.
Apply Bold to the Following Paragraph Using Standard VBA
Use a standard VBA macro loop to locate a specific character and bold the paragraph directly beneath it.
This solution utilizes the Find object in VBA to locate a target character, redefines the selection range, and shifts it to the next paragraph to apply the bold font property.
In your word processor, press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
Click on 'Insert' in the top menu bar and select 'Module' to create a blank script window.
Write a script that uses Selection.Find to locate your character (e.g., '#'). Set a Range object (rng), use 'rng.MoveStart wdParagraph, 1' to move to the next paragraph, and apply 'rng.Paragraphs(1).Range.Font.Bold = True'.
Press F5 or click the green 'Run' button in the toolbar to execute the macro. The script will loop through the document and bold every paragraph following your specified character.

Adapt the VBA Macro for Right-to-Left (RTL) Text
Modify the VBA script using Font.BoldBi for Hebrew or other RTL languages to format the same paragraph after the target character.
Use Macros to Automate Formatting in WPS Writer
WPS Office supports VBA macros, allowing you to automate repetitive formatting tasks like conditional bolding seamlessly. With high compatibility with Microsoft Word documents, you can run your existing VBA scripts directly in WPS Writer.
- 1. Open WPS Writer: Launch WPS Office and open the document where you want to apply the conditional formatting.
- 2. Enable Developer Tools: Navigate to the 'Developer' tab on the top ribbon. If it is hidden, enable it in the settings.
- 3. Open VBA Editor: Click on 'Macros' or 'Visual Basic', or simply press ALT + F11 to access the built-in macro editor.
- 4. Insert and Run Code: Insert a new module, paste your bolding macro script, and click Run to format your document automatically.

Frequently Asked Questions
Why is my VBA macro not bolding the correct paragraph?
This usually happens if the target character is not unique or if the document structure uses line breaks (Shift+Enter) instead of standard paragraph breaks (Enter). Ensure your document uses true paragraph markers.
What is the difference between Font.Bold and Font.BoldBi in VBA?
Font.Bold is used for standard left-to-right languages like English. Font.BoldBi is a bidirectional property specifically required to apply bold formatting to right-to-left (RTL) languages such as Hebrew or Arabic.
Can I reverse the bold formatting if the macro makes a mistake?
Running a macro often clears the standard undo history, meaning you cannot simply press Ctrl+Z. It is highly recommended to save a backup of your document before running the macro, or you can write a separate macro to select all text and set Font.Bold = False.




