Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Highlight all instances of a word in MS-Word
Message
De
02/07/2008 13:03:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01328241
Message ID:
01328298
Vues:
8
>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform