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 13:03:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/07/2008 12:04:24
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01328241
Message ID:
01328298
Views:
7
>>>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
>
Well maybe it works different under w2003 and edits the text even if replacement text is not set.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform