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 12:04:24
 
 
À
02/07/2008 11:58:28
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:
01328260
Vues:
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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform