Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word automation find and replace
Message
 
À
01/12/2004 15:33:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00966187
Message ID:
00966202
Vues:
24
This should switch you to the footer of a word document.
#DEFINE wdSeekPrimaryFooter 4
#DEFINE wdSeekPrimaryHeader 1
LOCAL oWord AS "Word.Application"
IF TYPE("oWord") <> "O"
   oWord = CREATEOBJECT("Word.Application")
 ENDIF
oWord.Documents.Open("d:\transit2.doc")
oWord.ActiveWindow.ActivePane.View.SeekView= wdSeekPrimaryFooter
>Hi

>
>I must do find and replace using OLE automation with Word. I have some code who is working but just in the body of the document. I am not able to find and replace in header and footer. I need to make word search in the whole document including header and footer.
>
>Here is a sample of my code.
>
> LOCAL oWord AS "Word.Application"
> IF TYPE("oWord") <> "O"
> oWord = CREATEOBJECT("Word.Application")
> ENDIF
> oWord.Documents.Open("d:\transit2.doc")
> oWord.VISIBLE = .t.
> loSelection = oWord.ActiveWindow.ActivePane.SELECTION
> loSelection.FIND.ClearFormatting()
>
> WITH loSelection.FIND
> .TEXT = "@Transit"
> .Replacement.TEXT = "81599999"
> .Forward = .T.
> .FORMAT = .F.
> .MatchCase = .F.
> .MatchWholeWord = .F.
> .MatchWildcards = .F.
> .MatchSoundsLike = .F.
> .MatchAllWordForms = .F.
> ENDWITH
> loSelection.FIND.Execute(,,,,,,,,,,2)
>
>Thanks
>
>Mike
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform