Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
VitaminL VitaminL is offline
external usenet poster
 
Posts: 1
Default find/replace with font color


Hi, I'm a freelance translator who uses Word all the time but still
knows shamefully little about its advanced features : (

I've wasted most of my morning trying to concoct a macro so I thought
I'd come here for advice.

I'd like to be able to:

1) Highlight a word
2) Hit a button
3) Have all instances of that word change red.

I feel certain that this can be done, I just can't figure out how to do
it. Right now it's a several step process using ctrl + H. I'd like to
make it a one step process.

Any help would be appreciated.

Thanks

~ vitaminL




--
VitaminL
  #2   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default find/replace with font color

I'm not sure why it would be a several-step process with Replace. That is,
it requires only a single Replace action:

1. In the Replace dialog, type the word (or paste it using Ctrl+V) in the
"Find what" box.

2. Click More.

3. With the insertion point in the (blank) "Replace with" box, click Format
| Font and choose Font color: Red.

4. Replace All.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"VitaminL" wrote in message
...

Hi, I'm a freelance translator who uses Word all the time but still
knows shamefully little about its advanced features : (

I've wasted most of my morning trying to concoct a macro so I thought
I'd come here for advice.

I'd like to be able to:

1) Highlight a word
2) Hit a button
3) Have all instances of that word change red.

I feel certain that this can be done, I just can't figure out how to do
it. Right now it's a several step process using ctrl + H. I'd like to
make it a one step process.

Any help would be appreciated.

Thanks

~ vitaminL




--
VitaminL



  #3   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default find/replace with font color

How about the following which will turn red all words that match the word at
the cursor. If you want the search to be case sensitive change the line
..MatchCase = False
to
..MatchCase = True


Sub TurnEmRed()
Dim sFindText As String
sFindText = Selection.Words(1)
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
'**********************
.Text = sFindText
.Replacement.Text = "^&"
.Replacement.Font.Color = wdColorRed
'**********************
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.Execute replace:=wdReplaceAll
End With
End With
End Sub

http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



VitaminL wrote:
Hi, I'm a freelance translator who uses Word all the time but still
knows shamefully little about its advanced features : (

I've wasted most of my morning trying to concoct a macro so I thought
I'd come here for advice.

I'd like to be able to:

1) Highlight a word
2) Hit a button
3) Have all instances of that word change red.

I feel certain that this can be done, I just can't figure out how to
do it. Right now it's a several step process using ctrl + H. I'd
like to make it a one step process.

Any help would be appreciated.

Thanks

~ vitaminL



  #4   Report Post  
Posted to microsoft.public.word.newusers
VitaminL[_2_] VitaminL[_2_] is offline
external usenet poster
 
Posts: 1
Default find/replace with font color


Thanks for the help! That macro is almost perfect, I work with Chinese
text so it sometimes has difficulties with determining when words start
and stop. Is there an easy way to change it to search and replace only
for the text I've selected (highlighted)?

Thanks again,

VitaminL




--
VitaminL
  #5   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default find/replace with font color

Change the line
sFindText = Selection.Words(1)
to
sFindText = Selection

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


VitaminL wrote:
Thanks for the help! That macro is almost perfect, I work with Chinese
text so it sometimes has difficulties with determining when words
start and stop. Is there an easy way to change it to search and
replace only for the text I've selected (highlighted)?

Thanks again,

VitaminL





  #6   Report Post  
Posted to microsoft.public.word.newusers
VitaminL[_3_] VitaminL[_3_] is offline
external usenet poster
 
Posts: 1
Default find/replace with font color


Works a charm.

Thank you very much~

vitaminL

Graham Mayor;2634797 Wrote:
Change the line
sFindText = Selection.Words(1)
to
sFindText = Selection

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


VitaminL wrote:-
Thanks for the help! That macro is almost perfect, I work with
Chinese
text so it sometimes has difficulties with determining when words
start and stop. Is there an easy way to change it to search and
replace only for the text I've selected (highlighted)?

Thanks again,

VitaminL -





--
VitaminL
  #7   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default find/replace with font color

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



VitaminL wrote:
Works a charm.

Thank you very much~

vitaminL

Graham Mayor;2634797 Wrote:
Change the line
sFindText = Selection.Words(1)
to
sFindText = Selection

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


VitaminL wrote:-
Thanks for the help! That macro is almost perfect, I work with
Chinese
text so it sometimes has difficulties with determining when words
start and stop. Is there an easy way to change it to search and
replace only for the text I've selected (highlighted)?

Thanks again,

VitaminL -



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
replace font color RPMitchal Microsoft Word Help 8 November 23rd 07 10:09 PM
Find multiple characters in one find using MSword find/replace Cliff Microsoft Word Help 2 October 29th 06 07:48 PM
I want to color underline through Find and Replace DT Microsoft Word Help 2 October 5th 06 06:15 PM
How Format Painter could copy the font color of a color text? Miksmith69 Microsoft Word Help 1 August 27th 05 06:43 PM
Use symbols from a custom font in Find and Replace Ellen Finkelstein Microsoft Word Help 1 June 14th 05 06:31 PM


All times are GMT +1. The time now is 11:16 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"