Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highlight all instances of a word in MS-Word
Message
From
02/07/2008 12:04:24
 
 
To
02/07/2008 11:58:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01328241
Message ID:
01328260
Views:
6
>>Can I open word like this
>>
>>
>>LOCAL o as word.application
>>oWord=CREATEOBJECT("Word.Application")
>>oDoc=oWord.Documents.Open("c:\vapps\vcpr3\temp\test.doc")
>>
>>
>>an highlight all instances of let's say the word King (whole word only)
>>
>>i can't find a way in word itself but there must be!
>>
>>Peter
>
>I don't think there is.
>Cetin

There is, at least in Word 2007. Here a macro I just recorded:
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting

  Selection.Find.Replacement.Highlight = True ' THIS!!!!!!

    With Selection.Find
        .Text = "king"
        .Replacement.Text = "king"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform