Share via

word Color Red

Anonymous
2025-04-29T20:56:33+00:00

Hello from Steve

I would like to please to use colour Red the below .Font.Color = wdColorRed is not working.

Sub Track_Name()

FindArray = Array("ELLE", "AWAS", "HAWE", "ASCO", "HAST", "PUKE", "NEWP", "RICC", _

"AWAP", "PHAR", "WAVE", "ROTO", "TAUR", "TREN", "WHAN", "RICS", "TERA", _

"OAMU", "TAUP", "WOOD", "RIVE", "WING", "MATA", "ASHB", "CROM", "OTAK", "TEAR", _

"WING", "CAMS", "WANG", "REEF", "KUMA", "RUAK", "TAUH", "GREY")

replArray = Array("ELLERSLIE", "AWAPUNI SYNTHETIC", "HAWERA", "ASCOT PARK", "HASTINGS", "PUKEKOHE", "NEW PLYMOUTH", "RICCARTON", _

"AWAPUNI", "PHAR LAP", "WAVERLEY", "ROTORUA", "TAURANGA", "TRENTHAM", "WHANGANUI", "RICCARTON SYNTHETIC", "TE RAPA", _

"OAMARU", "TAUPO", "WOODVILLE", "RIVERTON", "WINGATUI", "MATAMATA", "ASHBURTON", "CROMWELL", "OTAKI-MAORI", "TE AROHA", _

"WINGATUI", "CAMBRIDGE SYNTHETIC", "WHANGANUI", "REEFTON", "KUMARA", "RUAKAKA", "TAUHERENIKAU", "GREYMOUTH")

For i = 0 To UBound(FindArray)

Options.DefaultHighlightColorIndex = wdNoHighlight

With Selection.Find

    .Font.Size = 14.5 

    .Font.Color = wdColorRed 

    .Text = FindArray(i) 

    .Replacement.Text = replArray(i) 

    .Forward = True 

    .Wrap = wdFindContinue 

    .Format = True 

    .MatchCase = True 

    .MatchWholeWord = True 

    .MatchWildcards = False 

    .MatchSoundsLike = False 

    .MatchAllWordForms = False 

End With

Selection.Find.Execute Replace:=wdReplaceAll

Next i

End Sub

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2025-04-29T21:33:14+00:00

If you want to set the color of the replaced words to red, change

.Font.Color = wdColorRed

to

.Replacement.Font.Color = wdColorRed

Similarly, if you want to set the font size of the replaced words to 14, change

.Font.Size = 14.5

to

.Replacement.Font.Size = 14.5

Here is a slightly streamlined version:

Sub Track_Name()
    Dim rng As Range
    Dim FindArray
    Dim ReplArray
    Dim i As Long
    FindArray = Array("ELLE", "AWAS", "HAWE", "ASCO", "HAST", "PUKE", "NEWP", "RICC", _
        "AWAP", "PHAR", "WAVE", "ROTO", "TAUR", "TREN", "WHAN", "RICS", "TERA", _
        "OAMU", "TAUP", "WOOD", "RIVE", "WING", "MATA", "ASHB", "CROM", "OTAK", "TEAR", _
        "WING", "CAMS", "WANG", "REEF", "KUMA", "RUAK", "TAUH", "GREY")
    ReplArray = Array("ELLERSLIE", "AWAPUNI SYNTHETIC", "HAWERA", "ASCOT PARK", "HASTINGS", "PUKEKOHE", "NEW PLYMOUTH", "RICCARTON", _
        "AWAPUNI", "PHAR LAP", "WAVERLEY", "ROTORUA", "TAURANGA", "TRENTHAM", "WHANGANUI", "RICCARTON SYNTHETIC", "TE RAPA", _
        "OAMARU", "TAUPO", "WOODVILLE", "RIVERTON", "WINGATUI", "MATAMATA", "ASHBURTON", "CROMWELL", "OTAKI-MAORI", "TE AROHA", _
        "WINGATUI", "CAMBRIDGE SYNTHETIC", "WHANGANUI", "REEFTON", "KUMARA", "RUAKAKA", "TAUHERENIKAU", "GREYMOUTH")
    Set rng = Selection.Range
    With rng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Replacement.Font.Size = 14.5
        .Replacement.Font.Color = wdColorRed
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = True
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        For i = 0 To UBound(FindArray)
            .Execute FindText:=FindArray(i), ReplaceWith:=ReplArray(i), Replace:=wdReplaceAll
        Next i
    End With
End Sub

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2025-04-29T21:50:34+00:00

    Hello HansV

    I thank you

    Also thank you for your version which I am now using.

    Allthe Best

    Steve

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-04-29T21:25:49+00:00

    Hello HansV

    Please I would like color to red.

    Was this answer helpful?

    0 comments No comments
  3. HansV 462.6K Reputation points
    2025-04-29T21:10:45+00:00

    Do you want to find the words if they are red, or do you want to change their color to red?

    Was this answer helpful?

    0 comments No comments