Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
keyword Search Macro?!?
I would like to create a macro or some other kind of function that
automatically highlight keywords when I open a document. Is that a capability within Word, or is there an outside resource anyone knows of that can accomplish this? Thanks! Stacy |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
keyword Search Macro?!?
The following macros will highlight (and remove the highlight) from a list
of words set in quotes and separated by commas in the line vFindText = Sub HighlightList() Dim rDcm As Range Dim vFindText As Variant Dim i As Long Set rDcm = ActiveDocument.Range '************************************************* vFindText = Array("Lorem", "dolor", "amet") '************************************************* 'Selection.HomeKey Unit:=wdStory With rDcm.Find .Forward = True .Wrap = wdFindStop .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Format = True .MatchCase = True For i = LBound(vFindText) To UBound(vFindText) .Text = vFindText(i) .Replacement.Text = "^&" .Replacement.Highlight = True .Execute replace:=wdReplaceAll Next i End With End Sub Sub RemoveHighlight() Dim rDcm As Range Set rDcm = ActiveDocument.Range With rDcm.Find .Text = "" .Highlight = True .Replacement.Text = "^&" .Replacement.Highlight = False .Execute replace:=wdReplaceAll 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 stacy05 wrote: I would like to create a macro or some other kind of function that automatically highlight keywords when I open a document. Is that a capability within Word, or is there an outside resource anyone knows of that can accomplish this? Thanks! Stacy |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SEARCH ON CATEGORY OR KEYWORD IN DOCUMENT PROPERTIES | Microsoft Word Help | |||
Macro for search and replace not working | Microsoft Word Help | |||
Search-and-replace macro never works | Microsoft Word Help | |||
search and replace macro genius? | Microsoft Word Help | |||
can I keyword search in Word? | New Users |