Reply
 
Thread Tools Display Modes
  #1   Report Post  
WCRicster
 
Posts: n/a
Default Find and Replace feature when recording a Macro

How can I use the Find and Replace feature when recording a Macro? I am
trying to set up a macro that will find a series of like words in a document
and bold them for quick recognition.
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

Using the macro recorder to record a Find and Replace action produces some
really ugly code. This is how you would do it starting from scratch:

Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="yourword", MatchWildcards:=False, _
Wrap:=wdFindStop, Forward:=True) = True
Set myrange = Selection.Range
myrange.Font.Bold = True
Loop
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"WCRicster" wrote in message
...
How can I use the Find and Replace feature when recording a Macro? I am
trying to set up a macro that will find a series of like words in a
document
and bold them for quick recognition.



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
Mega macro with find and replace (HELP!) DKM Microsoft Word Help 1 May 10th 05 06:15 PM
Find and Replace GREEK symbols in XP, 2K & 97 Jazz Microsoft Word Help 3 April 8th 05 08:13 PM
Problem with function "Find and Replace" in Word. Pat Microsoft Word Help 3 March 16th 05 01:04 PM
how can I carry out a find and replace within a Word header mike@ukcca Microsoft Word Help 1 March 12th 05 04:30 PM
Find and Replace anomaly BruceM Microsoft Word Help 7 January 18th 05 05:47 PM


All times are GMT +1. The time now is 10:46 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"