<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>try this foo function:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>function Foo(const txt :String)
:Boolean;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>var</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2> <SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>FootRng :OleVariant;</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2><SPAN
class=194331504-01102004>begin</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2><SPAN
class=194331504-01102004></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2><SPAN class=194331504-01102004> repeat
</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2> FootRng:=
Doc.StoryRanges.Item(wdFootnotesStory);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>
FootRng.Collapse(wdCollapseEnd);<BR> FootRng.Find.Text:=
txt;<BR> FootRng.Find.Forward:=
True;<BR> FootRng.Find.Wrap:=
FindWrap;<BR> FootRng.Find.Format:= True;<BR>
FootRng.Find.MatchCase:= False;<BR>
FootRng.Find.MatchWholeWord:= False;<BR>
FootRng.Find.MatchWildcards:= False;<BR>
FootRng.Find.MatchSoundsLike:= False;<BR>
FootRng.Find.MatchAllWordForms:= False;<BR> until not
FootRng.Find.Execute;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>end;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>regards.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=194331504-01102004><FONT face=Arial
color=#0000ff size=2>Allan</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> delphi-bounces@ns3.123.co.nz
[mailto:delphi-bounces@ns3.123.co.nz] <B>On Behalf Of </B>Marshall,
Paul<BR><B>Sent:</B> Friday, 1 October 2004 4:08 p.m.<BR><B>To:</B> NZ Borland
Developers Group - Delphi List<BR><B>Subject:</B> [DUG] Word
Automation<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff size=2>I'm
using Word automation to create a report. </FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2>Opening a template file, and using Find/Replace to substitute various
tokens with real data.</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff size=2>This
sort of thing seems to work:</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2>WordDoc1.Content.Find.Execute(vSearchText, EmptyParam, EmptyParam,
EmptyParam, EmptyParam,
EmptyParam,<BR>
EmptyParam, vWrap, EmptyParam, vReplaceText, vAll,
EmptyParam,<BR>
EmptyParam, EmptyParam, EmptyParam);</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff size=2>But it
only finds and replaces in the body of the document, not in the header or footer
sections.</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff size=2>Can
anyone tell me what I need to do?</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2>Paul.</FONT></SPAN></DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff
size=2> </DIV>
<DIV><BR></DIV></FONT></SPAN><FONT face=Arial size=1>
<HR>
<P><STRONG>Attention: </STRONG>The information contained in this message and/or
attachments from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or taking
of any action in reliance upon, this information by persons or entities other
than the intended recipients is prohibited by AgResearch Limited. If you have
received this message in error, please notify the sender immediately.</P>
<HR>
</FONT></BODY></HTML>