Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting Text in Word
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Selecting Text in Word
Divers
Thread ID:
00505735
Message ID:
00505735
Vues:
65
I am using the Find method to locate a specific string of text in a Word doc. The Execute() is returning TRUE, so now I want an object reference to that. I am trying oRange = oWord.Selection which does return an object reference.

However, when I try to perform operations on that selection, I find that the selection [cursor position in the Word Doc] is somewhere else [e.g., the beginning of the document]. If I actually do this Find in the Word doc manually, the string is found and selected. When I do this via automation, the string is found but not selected.

The code looks like:
with loRange.Find
   .ClearFormatting()
   .Text = This.cFindValue
   .Replacement.Text = ""
   .Forward = .t.
   .Wrap = wdFindContinue
   .Format = .f.
   .MatchCase = .f.
   .MatchWholeWord = .f.
   .MatchWildcards = .f.
   .MatchSoundsLike = .f.
   .MatchAllWordForms = .f.
   llRetVal = .Execute()    && RETURNS TRUE
endwith
if llRetVal
   return This.oWord.Selection  && return an object reference
else
   return .null.
endif
What am I missing? TIA!
Mark McCasland
Midlothian, TX USA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform