Document Editing Problems

Find Word Paragraphs by First-Line Indent and Apply a Style

Amos GikundaAmos Gikunda Nov 25, 2026 869 views

Question details

Find paragraphs with a 0.24-inch first-line indent and apply the Body Text First Indent style.

Find Word Paragraphs by First-Line Indent and Apply a Style
Product
Microsoft Word
Device & OS
not provided
Scenario
The user wants to identify paragraphs by their paragraph formatting and assign a consistent style.
Observed behavior
Word's Find dialog displays the first-line indent as 0 characters instead of the expected value in inches.
Before you start

Open the document in a desktop version of Word that supports VBA. Check a target paragraph under Home > Paragraph to confirm its first-line indent and whether automatic spacing before and after are disabled.

Solution 1Recommended

Use a Word VBA macro to find and style matching paragraphs

Search for the indent in points and include the automatic spacing settings that helped the replacement work.

The macro searches the main document from the beginning and applies the built-in Body Text First Indent style. It matches only paragraphs with automatic spacing before and after turned off.

Setting the character-unit indent may affect the inch-based value in some configurations. The macro checks the resulting first-line indent before making changes and stops if it no longer matches 0.24 inches.

1
Open the VBA editor

In desktop Word, open the document and select Developer > Visual Basic. On Windows, you can also press Alt+F11.

2
Insert the macro

In the VBA editor, select Insert > Module and paste this code: Sub StyleIndentedParagraphs() Dim found As Boolean Dim matchStart As Long Selection.HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Text = "" .Forward = True .Wrap = wdFindStop .Format = True .ParagraphFormat.FirstLineIndent = InchesToPoints(0.24) .ParagraphFormat.CharacterUnitFirstLineIndent = 0 .ParagraphFormat.SpaceBeforeAuto = False .ParagraphFormat.SpaceAfterAuto = False End With If Abs(Selection.Find.ParagraphFormat.FirstLineIndent - InchesToPoints(0.24)) > 0.01 Then MsgBox "The character-unit setting changed the indent. Review the Find formatting before continuing." Exit Sub End If Do found = Selection.Find.Execute If Not found Then Exit Do matchStart = Selection.Start Selection.Style = ActiveDocument.Styles(wdStyleBodyTextFirstIndent) Selection.Collapse Direction:=wdCollapseEnd If Selection.Start >= ActiveDocument.Content.End - 1 Then Exit Do If Selection.Start <= matchStart Then Selection.MoveRight Unit:=wdCharacter, Count:=1 Loop End Sub

3
Run and inspect the result

Click in the main document, then run StyleIndentedParagraphs from Developer > Macros. Inspect several changed paragraphs and their style under Home > Styles.

Use a Word VBA macro to find and style matching paragraphs
Check the spacing criteria: If expected paragraphs are skipped, check their Space Before and Space After automatic settings. The style can also change paragraph formatting according to its own definition.
Free Microsoft Office alternative

Edit and style documents with WPS Writer

WPS Writer is a free, lightweight alternative for editing documents in a familiar interface. Open compatible Word files and continue working with paragraph formatting and styles as you migrate between office suites.

Adjust paragraph indents and apply styles in WPS WriterOpen and save compatible Microsoft Word DOCX and DOC filesWork in a familiar, easy-to-use editing interfaceUse a free, lightweight office suite for everyday documents
microsoft office alternative - wps office

Frequently Asked Questions

Why does Word show the indent in characters instead of inches?

Word can display paragraph indents in character units depending on its settings and language support. The VBA approach sets the first-line indent in points using InchesToPoints(0.24) and checks the resulting value.

Why are some paragraphs with a 0.24-inch indent not found?

The macro also requires Space Before Auto and Space After Auto to be False. Select a missed paragraph and check its settings under Home > Paragraph before changing the search criteria.

Will applying the style keep the original indent?

Not necessarily. A paragraph style can define its own indent and spacing. After running the macro, select a changed paragraph and check Home > Paragraph and Home > Styles.

Does the macro search headers and footers?

No. Run it with the insertion point in the main document; the search is intended for the main document story, not headers, footers, or other separate stories.