>The VB script code that I captured looks like this:
>
> Selection.HomeKey Unit:=wdStory
> Selection.Find.ClearFormatting
> Selection.Find.Replacement.ClearFormatting
> With Selection.Find
> .Text = "#$@"
> .Replacement.Text = " 13"
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute Replace:=wdReplaceAll
>
>I generated the following VFP code for it (Where loWord is the Word object and I have the Word97 constants (wdStory,etc) as a .h file):
>
>loWord.SELECTION.HomeKey(wdStory)
>loWord.SELECTION.FIND.ClearFormatting
>loWord.SELECTION.FIND.Replacement.ClearFormatting
>loReplace = loWord.SELECTION.FIND
>WITH loReplace
>.TEXT = "#$@"
>.Replacement.TEXT = '13'
>.Forward = .T.
>.WRAP = wdFindContinue
>.FORMAT = .F.
>.MatchCase = .F.
>.MatchWholeWord = .F.
>.MatchWildcards = .F.
>.MatchSoundsLike = .F.
>.MatchAllWordForms = .F.
>ENDWITH
>loReplace.Execute(wdReplaceAll)
>
>But the replace all is not being done, can anyone give me a clue as to what I did wrong. The code does not error in VFP, if finishes OK, but the '#$@' is not getting replaced.
>
>TIA
Brett,
You could use the dialog.
#define wdDialogEditReplace 117
with .dialogs(wdDialogEditReplace)
.Find = "#$@"
.Replace = "13"
.MatchCase = .f.
.ReplaceAll = .t.
.Execute
endwith
Cetin