Word Automation Puts Table Over the Document Title

I’m trying to create a report that is passed to Word. Each page is titled with the Customers name, and there is a table below this which details their current order. However, when the table is produced, having placed the Customers name at the top of the page and moved down two lines to place the table at that point the cursor is moved back to the top of the page and the title is over-written with the table! How to I get the table to be inserted at the cursor’s current line…? The declarations are: WrdApp.Documents.Add; // new blank page WrdRange := WrdApp.ActiveDocument.Range; wrdSelection := WrdApp.Selection; WrdRange.Font.Size := 10; The heading is thus: wrdSelection.Font.Italic(1); wrdSelection.TypeText('Customer: ’ + Customer.“No.” + ’ ’ + Customer.Name); wrdSelection.Font.Italic(0); wrdSelection.TypeParagraph; wrdSelection.TypeParagraph; I’m using the following to generate the table: wrdTable := WrdRange.Tables.Add(WrdRange,(Rows + 1),Collumns); I’ve tried changing the above to (which hasn’t worked): wrdTable := WrdRange.Tables.Add(WrdRange,(Rows + 1),Collumns); Thanks!

Matt, I have done quite a bit of word automation and have found that creating the functions behind the word document and using it as a template each time. Then run the functions from Navision (once you’ve initialised and opened the document), to do what ever you want. To see how to do things with automation, start a macro and then look at the code - this will give you an idea as to what your functions will need to do. I have done this for populating word documents and for mail merging to word documents and find it a lot easier this way. Hope this helps