Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 04-19-2022, 12:43 AM
Guessed's Avatar
Guessed Guessed is offline Change font color on selected text only Windows 10 Change font color on selected text only Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 04-19-2022, 01:56 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

Thank you for your quick and solid solution, Gold Dust - Thank you
Reply With Quote
Reply



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 05:20 PM.


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