Discussion:
Automatically highlight key words in a document?
(too old to reply)
davegeorge7
2005-02-17 18:23:06 UTC
Permalink
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
Martin P
2005-02-17 18:51:14 UTC
Permalink
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
davegeorge7
2005-02-17 19:37:03 UTC
Permalink
What I am looking for needs to run at document open time using the specified
document as "input" and automatically color highlighting key words that it
searches for and finds, based upon a suppied list of keywords and the
associated highlight color each word gets. This is for a scientific research
project, needing to search session transcripts to highlight key words or
phrases found in those transcripts.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
Daiya Mitchell
2005-02-17 19:52:44 UTC
Permalink
It's basically a lot of Find and Replace operations, but you'll need a macro
to ask for the information, and then plug it into a macro that runs the
F&Rs. The F&R dialog also will not permit you to chose the highlight color,
though the macro can probably handle that.

I suggest you ask in one of the groups with VBA or Programming in the name,
giving your detailed explanation and the *version of Word* in use.
Post by davegeorge7
What I am looking for needs to run at document open time using the specified
document as "input" and automatically color highlighting key words that it
searches for and finds, based upon a suppied list of keywords and the
associated highlight color each word gets. This is for a scientific research
project, needing to search session transcripts to highlight key words or
phrases found in those transcripts.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
Daiya Mitchell
2005-02-17 19:43:12 UTC
Permalink
An "after the fact" alternative would be Find & Replace, you have to click
on More to get access to formatting commands in the F&R box.

If the keyword list changes often, you could probably create a macro that
would make it easy to plug in new keywords. If always the same keywords,
setting up the AutoCorrects is probably better.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
davegeorge7
2005-02-17 22:07:04 UTC
Permalink
I don't mind building a Macro to do this, but Find/Replace is too limited in
its text translation capabilities. The key is that certain words 20 or so
need to be color highlighted with specific colors, like "depressed" will
always be highlighted Blue and "angry" will always be highlighted Red. These
words will not change over time, but some new words may be added. The
easiest way is to have a list of words to search for and an "action"
associated with each word, e.g if "depressed", then "Highlight Blue". This
dies not seem hard to do programatically, but maybe there is a macro or
program out there that already does it so I don't end up reinventing the
wheel? Thanks for your thoughts on this.
Post by Daiya Mitchell
An "after the fact" alternative would be Find & Replace, you have to click
on More to get access to formatting commands in the F&R box.
If the keyword list changes often, you could probably create a macro that
would make it easy to plug in new keywords. If always the same keywords,
setting up the AutoCorrects is probably better.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
Suzanne S. Barnhill
2005-02-18 00:08:43 UTC
Permalink
FWIW, you can apply character styles with F&R, and character styles can
include shading (not highlighting but text shading from the Format | Borders
and Shading dialog).
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Post by davegeorge7
I don't mind building a Macro to do this, but Find/Replace is too limited in
its text translation capabilities. The key is that certain words 20 or so
need to be color highlighted with specific colors, like "depressed" will
always be highlighted Blue and "angry" will always be highlighted Red.
These
Post by davegeorge7
words will not change over time, but some new words may be added. The
easiest way is to have a list of words to search for and an "action"
associated with each word, e.g if "depressed", then "Highlight Blue".
This
Post by davegeorge7
dies not seem hard to do programatically, but maybe there is a macro or
program out there that already does it so I don't end up reinventing the
wheel? Thanks for your thoughts on this.
Post by Daiya Mitchell
An "after the fact" alternative would be Find & Replace, you have to click
on More to get access to formatting commands in the F&R box.
If the keyword list changes often, you could probably create a macro that
would make it easy to plug in new keywords. If always the same keywords,
setting up the AutoCorrects is probably better.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want "keyword"
to be in bold. Type the word, highlight it and change the format to bold. Go
to Tools, AutoCorrect Options and type "keyword" on the left-hand side.
Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word document, based
upon a supplied keyword list or table? As a macro function or some other
pre-process?
Graham Mayor
2005-02-18 08:10:48 UTC
Permalink
Fellow MVP Greg Maxey is away this week or he would have pointed out his web
link - http://gregmaxey.mvps.org/Find_it_tool_bar.htm which would be a means
to do what you want. This allows you to easily highlight words in different
colours.

I also have a macro for highlighting lists of Words which could be adapted
to your own requirements. Replace the words in the vFindText arrays with
your own words. You can continue the theme with other colours and words as
required.


Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long

'highlight red words
Options.DefaultHighlightColorIndex = wdRed
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

vFindText = Array("anger", "violence", "fighting")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute replace:=wdReplaceAll
Next i
End With

'Highlight blue words
Options.DefaultHighlightColorIndex = wdBlue

vFindText = Array("depression", "misery")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindContinue

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute replace:=wdReplaceAll
Next i
End With
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Post by davegeorge7
I don't mind building a Macro to do this, but Find/Replace is too limited in
its text translation capabilities. The key is that certain words 20 or so
need to be color highlighted with specific colors, like "depressed" will
always be highlighted Blue and "angry" will always be highlighted
Red. These words will not change over time, but some new words may
be added. The
easiest way is to have a list of words to search for and an "action"
associated with each word, e.g if "depressed", then "Highlight Blue".
This
dies not seem hard to do programatically, but maybe there is a macro or
program out there that already does it so I don't end up reinventing the
wheel? Thanks for your thoughts on this.
Post by Daiya Mitchell
An "after the fact" alternative would be Find & Replace, you have to click
on More to get access to formatting commands in the F&R box.
If the keyword list changes often, you could probably create a macro
that would make it easy to plug in new keywords. If always the same
keywords, setting up the AutoCorrects is probably better.
Post by Martin P
AutoCorrect Options should work for this. Suppose you always want
"keyword" to be in bold. Type the word, highlight it and change the
format to bold. Go to Tools, AutoCorrect Options and type "keyword"
on the left-hand side. Choose formatted text and press OK.
Post by davegeorge7
How can I automatically color hightlight key words in a Word
document, based upon a supplied keyword list or table? As a macro
function or some other pre-process?
Loading...