Share via

Word Font Size 12

SteveD 515 Reputation points
2026-05-30T20:58:32.8066667+00:00

Hello from Steve

Where below please where would I put Font 12

Sub Left()

Dim rng As range

Dim innerRng As range

Set rng = ActiveDocument.Content

With rng.Find

.ClearFormatting

.Text = "L\([0-9]{1,}-[0-9]{1,}-[0-9]{1,}\)"

.MatchWholeWord = False

.Format = False

.Forward = True

.MatchWildcards = True

.Wrap = wdFindStop

Do While .Execute

    If rng.Font.ColorIndex <> wdRed Then

        Set innerRng = rng.Duplicate

        innerRng.MoveStart wdCharacter, 2

        innerRng.MoveEnd wdCharacter, -1

        innerRng.Font.Color = wdColorBlue

        innerRng.HighlightColorIndex = wdYellow

        innerRng.Font.Bold = True

    End If

    If rng.Start >= ActiveDocument.Content.End Then Exit Do

    rng.Collapse wdCollapseFound

Loop

End With

End Sub

Microsoft 365 and Office | Word | For home | Windows
0 comments No comments

Answer accepted by question author

AI answer

2026-05-30T20:58:47.0433333+00:00

Add the font size setting to the same innerRng.Font block where bold and color are applied. For example:

Sub Left()

    Dim rng As Range
    Dim innerRng As Range

    Set rng = ActiveDocument.Content

    With rng.Find
        .ClearFormatting
        .Text = "L\([0-9]{1,}-[0-9]{1,}-[0-9]{1,}\)"
        .MatchWholeWord = False
        .Format = False
        .Forward = True
        .MatchWildcards = True
        .Wrap = wdFindStop

        Do While .Execute
            If rng.Font.ColorIndex <> wdRed Then
                Set innerRng = rng.Duplicate
                innerRng.MoveStart wdCharacter, 2
                innerRng.MoveEnd wdCharacter, -1

                innerRng.Font.Color = wdColorBlue
                innerRng.HighlightColorIndex = wdYellow
                innerRng.Font.Bold = True
                innerRng.Font.Size = 12   ' ← set font size 12 here
            End If

            If rng.Start >= ActiveDocument.Content.End Then Exit Do
            rng.Collapse wdCollapseFound
        Loop
    End With

End Sub

This ensures only the found inner range is formatted as blue, bold, highlighted, and size 12.


References:

AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.