I want to change the font colour of all left indented paragraphs (in documents exported as rtf from another program). The paragraphs dialog shows they are all indented by 7.94 cm.

I have done this by using the style pane with some indented text selected, show paragraph formats option ticked, select all instances but this does not select differently formatted text with the same indent, and is not recorded by the macro recorder at all.

I have tried the find replace box, pasting the left indent from the paragraph format dialog of the target paragraphs into the find format, paragraph box (which does record, .LeftIndent = CentimetersToPoints(7.94) but that does not find the paragraphs at all.

(This is what recorded and what else I tried:)

    Sub E___IndentedParasBlueFont_DRAFT_TOFIX()

    Selection.Find.ParagraphFormat.LeftIndent = CentimetersToPoints(7.94) 'find left indented paras- DOESNT FIND
    With Selection.Find.ParagraphFormat
        .LeftIndent = CentimetersToPoints(7.94) 'find left indented paras- DOESNT FIND

'        .SpaceBeforeAuto = False
'        .SpaceAfterAuto = False
'        .CharacterUnitLeftIndent = 0
    End With

    Selection.Find.Replacement.Highlight = True 'ADD HIGHLIGHT
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

' a_ Macro
' select all indented paras-styles pane

    With Selection.ParagraphFormat
        .LeftIndent = 4500 '7.94 cm - recorded
        .RightIndent = 0
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 200
        .SpaceAfterAuto = False
        .Alignment = wdAlignParagraphLeft
        .FirstLineIndent = 0
    End With
    Application.Run MacroName:= _
'    CommandBars("Navigation").Visible = False
'    Application.Move Left:=-1638, Top:=-1638
End Sub

I tried changing the indent in the recorded macro to that shown in the style for the selected text, .LeftIndent = 4500 but that returned an error.

I have googled everything I can think of but not found any results. What search term will correctly find the paragraphs indented by 7.94 cm? Alternatively, is it possible to write a macro following the approach available in the styles pane, "select all instances" of the unnamed style containing that indent?

indent, style sample

  • Hi Charles, thank you for your reply 1. the documents do not have any styles set up in them, they are rtf documents created by another application. My approach was to either modify the unnamed style, or select all instances of it and modify the selection, but I couldn't find the VBA code to select it? 2. What "find and replace" macro did you have in mind? I recorded find and replace macros as set out in my original question, which did not find the indented paragraphs. My question is what to search for if using find and replace?
    – Piecevcake
    Dec 22, 2021 at 21:23
  • Um I don't want to spend hours modifying hundreds of huge documents into styles I will never use. I just want to format the indented paragraphs, using vba. They are exported SMS conversations, over years, the indented paragraphs are one participant. Once I have the indented paragraphs formatted blue font I can unindent the paragraphs for readabilty. I already use headings to highlight important parts.
    – Piecevcake
    Dec 28, 2021 at 2:13
  • @Charles Kenyon - "first modify all differently formatted text to headings and other styles" - how do I select all instances of the "differently formatted" indented text to modify it?.
    – Piecevcake
    Dec 28, 2021 at 2:46

2 Answers 2


The text was probably originally indented using a different unit, like inches. Even if precisely converted, Word won't find indentations which was entered using a different unit. Try changing units to inches.

You don't need VBA for that. Just enter 3.125" in the Find Paragraph instead of 3.94. But if you prefer recording a macro, it will not help typing inches in the dialog box as long as the unit in Word is set to inches. You'll have to edit the VBA directly. Replace CentimetersToPoints(7.94) with InchesToPoints(3.125).

If it doesn't work, try different units. You can find all available units at Options > Advanced > scroll down to the Display section, and choose from the dropdown menu next to "Show measurements in units of:"


The previous answer should work, but this may be easier (edited to better match the question):

Assuming that all paragraphs are either indented by 7.94 cm or not at all, you can run this bit of VBA:

Sub myColorIndented()
Dim myParagraph As Word.Paragraph

    For Each myParagraph In ActiveDocument.Paragraphs
        If myParagraph.Format.LeftIndent > 0 Then
            myParagraph.Range.Font.ColorIndex = wdRed
        End If
End Sub

This will make the font red on all indented paragraphs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .