Global Replace in Word

L

LarryOfKnollwood

I write my talks in Word and then use the Replace Command to bold and
underline specific words to help my eyes move through the text. Is there a
global way of doing this rather than word by word? I tried separating the
words by comma's, but didn't work.
 
M

macropod

Hi LarryOfKnollwood,

In the Find box, insert the word you're looking for,
In the Replace box, type '^&', then choose More|Format|Font > Bold.
 
G

Graham Mayor

Put the words (not case sensitive) in a single column table save the table
as a document and put its path/name where shown in the following macro. Then
run the macro on your document.

Sub ReplaceFromTableList()

Dim ChangeDoc As Document, RefDoc As Document
Dim cTable As Table
Dim oldPart As Range
Dim i As Long
Dim sFname As String
'********************************************
sFname = "D:\My Documents\Test\changes2.doc"
'********************************************
Set RefDoc = ActiveDocument
Set ChangeDoc = Documents.Open(sFname)
Set cTable = ChangeDoc.Tables(1)
RefDoc.Activate
For i = 1 To cTable.Rows.Count
Set oldPart = cTable.Cell(i, 1).Range
oldPart.End = oldPart.End - 1
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
'****************************************
.Replacement.Font.Underline = True
.Replacement.Font.Bold = True
'****************************************
.Execute findText:=oldPart, _
ReplaceWith:="^&", _
Replace:=wdReplaceAll, _
MatchWildcards:=False, _
Forward:=True, _
Wrap:=wdFindContinue
End With
End With
Next i
ChangeDoc.Close wdDoNotSaveChanges
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top