Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-19-2022, 12:25 AM
oddworld oddworld is offline Change font color on selected text only Mac OS X Change font color on selected text only Office 2021
Novice
Change font color on selected text only
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change font color on selected text only 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
Change font color on selected text only How to change the font color of specific text within a Word table cell epid011 Word Tables 2 05-15-2017 05:21 PM
Change font color on selected text only 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft