Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Highlight all instances of a word in MS-Word
Message
 
To
02/07/2008 10:39:15
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01328241
Message ID:
01328264
Views:
7
This message has been marked as the solution to the initial question of the thread.
>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
LOCAL oWord AS "Word.Application"
oWord = CREATEOBJECT("Word.Application")
oWord.Documents.Open("c:\vapps\vcpr3\temp\test.doc")

oWord.Visible = .t.
loSelection = oWord.ActiveWindow.ActivePane.SELECTION
loSelection.Find.ClearFormatting()
loSelection.Find.Replacement.Highlight = .t.

WITH loSelection.Find
     .Text = "king"
     .Replacement.Text = "king"
     .Forward = .t.
     .Wrap = 1
     .Format = .t.
     .MatchCase = .f.
     .MatchWholeWord = .t.
     .MatchWildcards = .f.
     .MatchSoundsLike = .f.
     .MatchAllWordForms = .f.
ENDWITH
loSelection.Find.Execute(,,,,,,,,,,2)
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