title: Lotus Notes OLE Word
body: <p>I have an agent that uses the StoryRanges object in MS Word OLE to do a find and replace in a word template with fields in Lotus Notes.  An example of the code I am using is here:</p>
  
  <pre><code>If (FoundWordDoc = True) then
   ForAll rngStory In objWordDoc.StoryRanges  
   rngStory.Find.Execute "{{createddate}}", False, True,,,,, 1,,Format$(doc.DocDate(0), "d mmmm yyyy"), 2,,,,
  End Forall
  </code></pre>
  
  <p>The template is now more complex than it used to be.  I need to populate a table based on some documents in Lotus Notes.  The number of rows is dependant on the number of records in Notes.  One way to do this is to tab my way through the table so that Word manages the additional rows - however I do not want to insert an actual tab.  I was thinking I would loop through an array to allow this data to be entered.</p>
  
  <p>I have used OLE To create a Word document from scratch however I am not sure how to go from doing a find an replace to actually inserting or adding to a table in the word document.</p>
  
  <p>Another solution I have thought of, but am unsure how to do it, is to locate a section in the document to create an anchor point and then add the table from there?</p>