View Single Post
 
Old 04-19-2022, 12:25 AM
oddworld oddworld is offline Mac OS X Office 2021
Novice
 
Join Date: Apr 2022
Posts: 5
oddworld is on a distinguished road
Default Change font color on selected text only

Hi all, I need help with my current macro. This procedure is changing all the letter ps that are currently selected in a range to a wingdings3 up arrow. I then run another procedure on all the selected letter qs in a range and change them to wingdings3 up arrows.

The data is cut and pasted from excel to my word document each month and I then have to reformat it.

The procedures are working. I would like some help in 2 ways
1. merge the two procedures into one &
2. Amend it so it colors the ps winding3 up arrow as Red font and qs wingding3 down arrows as Green font

This document is 40 pages long, the data is in multiple tables, I select the appropriate text and then run the two individual macros.
i would appreciate any assistance or guidance.


[With Selection.Find

.ClearFormatting
.Replacement.ClearFormatting
.Text = "p"
.Replacement.Text = Chr(112)
.Replacement.Font.Name = "Wingdings 3"
.Forward = True
.Wrap = wdFindStop
'.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
'Selection.Font.ColorIndex = wdRed

End With

End Sub]

and 2nd sub

[Sub ReplaceAll_qs()


With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "q"
.Replacement.Text = Chr(113)
.Replacement.Font.Name = "Wingdings 3"
.Forward = True
.Wrap = wdFindStop
'.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
Selection.Font.ColorIndex = wdGreen

End With
End Sub]



Cheers Odd
Reply With Quote