I'm trying to insert data into a dynamic table in a template, but I don't seem to be able to add new rows. As a result, my table has one row containing the last list item.

To test the procedure I've written the code below, and the Word template I'm using is attached here if required: BMS-0900-011-02.zip

The problem might be how I'm calling the .Rows.Add routine. I'm quite new at this and still wrapping my head around all the hierarchy.

Any help would be greatly appreciated.

[VBA]' VBA launched from SolidWorks

Sub main()

' Launch Word and load the template
Set objWord = New Word.Application
objWord.Documents.Add "C:\Users\Chris\Desktop\BMS-0900-011-02.dotx"
objWord.Visible = True

'How many documents are there?
Dim numDTDocs As Integer
numDTDocs = 5

' Create list of transmitted documents
Dim TransmittalList() As String
ReDim TransmittalList(1 To numDTDocs * 3) As String

For i = 1 To numDTDocs
TransmittalList(3 * i - 2) = "Document " & Str(i) & Chr(14)
TransmittalList(3 * i - 1) = "Description " & Str(i) & Chr(14)
TransmittalList(3 * i - 0) = "1" & Chr(14)
Next i

' Add header information using predefined bookmarks
With objWord.ActiveDocument.Bookmarks
.Item("DTClient").Range.Text = "Javan Fabrications"
.Item("DTAddress1").Range.Text = "26 Nourse Avenue"
.Item("DTAddress2").Range.Text = "Epping Industria"
.Item("DTPrjNo").Range.Text = "00112"
.Item("DTDate").Range.Text = Str(Date)
End With

For i = 1 To numDTDocs
objWord.ActiveDocument.Tables(1).Cell(i + 2, 1).Range.Text = TransmittalList(3 * i - 2)
objWord.ActiveDocument.Tables(1).Cell(i + 2, 2).Range.Text = TransmittalList(3 * i - 1)
objWord.ActiveDocument.Tables(1).Cell(i + 2, 3).Range.Text = TransmittalList(3 * i - 0)
If i < numDTDocs Then
objWord.ActiveDocument.Tables(1).Rows.Add
End If
Next i

End Sub[/VBA]