<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4943.400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Yes, the Content object is just the main text. You 
can use the Storyranges collection to access other parts of the document (eg 
header, footer etc). Example (from the Word Visual Basic 
reference):</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Use the NextStoryRange property to loop through all stories in 
a document. The following example searches each story in the active document for 
the text "Microsoft Word." When the text is found, it's formatted as 
italic.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2>For Each myStoryRange In 
ActiveDocument.StoryRanges<BR>&nbsp;&nbsp;&nbsp; myStoryRange.Find.Execute 
FindText:="Microsoft Word", Forward:=True<BR>&nbsp;&nbsp;&nbsp; While 
myStoryRange.Find.Found<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myStoryRange.Italic = True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myStoryRange.Find.Execute FindText:="Microsoft Word", 
Forward:=True<BR>&nbsp;&nbsp;&nbsp; Wend<BR>&nbsp;&nbsp;&nbsp; While Not 
(myStoryRange.NextStoryRange Is 
Nothing)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set myStoryRange = 
myStoryRange.NextStoryRange<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myStoryRange.Find.Execute FindText:="Microsoft Word", 
Forward:=True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; While 
myStoryRange.Find.Found</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myStoryRange.Italic = 
True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myStoryRange.Find.Execute FindText:="Microsoft Word", 
Forward:=True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Wend<BR>&nbsp;&nbsp;&nbsp; Wend<BR>Next myStoryRange</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>(End of example)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm not sure whether the Word VB Help is installed 
by default. If you don't have it, often you can figure out what you need to do 
by going through the actions you want to perform in the macro recorder and then 
studying the code it writes.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Hope this is enough to get you headed in the right 
direction. I haven't tried it out for myself, but it looks like it's addressing 
the right area for what you're trying to do.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Brian</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=paul.marshall@agresearch.co.nz 
  href="mailto:paul.marshall@agresearch.co.nz">Marshall, Paul</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@ns3.123.co.nz 
  href="mailto:delphi@ns3.123.co.nz">NZ Borland Developers Group - Delphi 
  List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, October 01, 2004 4:08 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [DUG] Word Automation</DIV>
  <DIV><BR></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>&nbsp;</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>&nbsp;</DIV>
  <DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff 
  size=2>WordDoc1.Content.Find.Execute(vSearchText, EmptyParam, EmptyParam, 
  EmptyParam, EmptyParam, 
  EmptyParam,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  EmptyParam, vWrap, EmptyParam, vReplaceText, vAll, 
  EmptyParam,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  EmptyParam, EmptyParam, EmptyParam);</FONT></SPAN></DIV>
  <DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
  <DIV><SPAN class=160495903-01102004><FONT face=Arial color=#0000ff 
  size=2>&nbsp;</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>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Delphi mailing 
  list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></BLOCKQUOTE></BODY></HTML>