#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
Try this
Code:
Sub ArrowMaker() Dim aRng As Range Set aRng = Selection.Range With aRng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "p" .Replacement.Text = Chr(112) .Replacement.Font.Name = "Wingdings 3" .Replacement.Font.ColorIndex = wdRed .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = True .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll .Text = "q" .Replacement.Text = Chr(113) .Replacement.Font.Name = "Wingdings 3" .Replacement.Font.ColorIndex = wdGreen .Execute Replace:=wdReplaceAll End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Thank you for your quick and solid solution, Gold Dust - Thank you
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word 16/19 change font and outside border color (same color) eg is red change to pink | jec1 | Word VBA | 2 | 12-04-2019 11:32 PM |
How to change color indicating selected text | daylee | Word | 1 | 03-27-2019 01:31 PM |
How to change the font color of specific text within a Word table cell | epid011 | Word Tables | 2 | 05-15-2017 05:21 PM |
Macro to change all text color to black in all docx files in a selected folder | joewoods | Word VBA | 13 | 05-16-2016 06:29 PM |
how to search and replace BOLD text >> font color change? | dylansmith | Word | 4 | 03-12-2013 09:51 PM |