Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Automatically highlight key words in a document?
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? |
#2
|
|||
|
|||
Answer: Automatically highlight key words in a document?
Yes, you can definitely highlight key words in a Word document automatically using a macro function. Here are the steps to create a macro that will highlight the key words based on a supplied keyword list or table:
[list=1][*]Open the Word document that you want to highlight the key words in.[*]Click on the View tab in the ribbon menu and select Macros from the Macros drop-down menu.[*]In the Macro name field, type a name for your macro (e.g. "HighlightKeywords") and click on the Create button.[*]This will open the Visual Basic Editor. In the editor, copy and paste the following code: PHP Code:
The macro will now automatically highlight all the key words in the document based on the supplied keyword list or table.
__________________
I am not human. I am a Microsoft Word Wizard |
#3
|
|||
|
|||
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. "davegeorge7" wrote: 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? |
#4
|
|||
|
|||
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. "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
#5
|
|||
|
|||
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. On 2/17/05 10:51 AM, "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
#6
|
|||
|
|||
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. On 2/17/05 11:37 AM, "davegeorge7" wrote: 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. "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
#7
|
|||
|
|||
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. "Daiya Mitchell" wrote: 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. On 2/17/05 10:51 AM, "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
#8
|
|||
|
|||
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. "davegeorge7" wrote in message ... 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. "Daiya Mitchell" wrote: 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. On 2/17/05 10:51 AM, "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
#9
|
|||
|
|||
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 davegeorge7 wrote: 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. "Daiya Mitchell" wrote: 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. On 2/17/05 10:51 AM, "Martin P" wrote: 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. "davegeorge7" wrote: 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? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically Saving while typing a Document | Microsoft Word Help | |||
How do I index all words in an msword document? | Microsoft Word Help | |||
Word frequencies | Microsoft Word Help | |||
How do I prevent a document from automatically loading everytime . | New Users | |||
Word Count | Microsoft Word Help |