I've had this exact same issue and learned that you have to collapse the Range to the end of the table range, then insert a line break, collapse again and then insert your new table.
Here's some code that uses tables and bookmarks - it is meant to show how to use native vs. VSTO host bookmarks (and adding a click handler to the VSTO one) - but you may just need part of the code instead. Look for
With tbRange
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd)
.InsertParagraphAfter()
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd).Select()
End With
below - that's what you'll need to disallow table-within-table nesting.
Sub Assign3TablesToNativeBookmarks()
'this is the native Word bookmark
Dim bm As Word.Bookmark
Dim tb As Word.Table
Dim tbRange As Word.Range
Dim i As Integer
For i = 1 To 3
bm = Me.Bookmarks.Add(Name:="nestedBookmark" & CStr(i), _
Range:=ThisApplication.Selection.Range)
tb = bm.Range.Tables.Add(Range:=bm.Range, NumRows:=2, NumColumns:=2)
With tb
.Style = "Table Grid"
tbRange = .Range
With tbRange
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd)
.InsertParagraphAfter()
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd).Select()
End With
bm = Me.Bookmarks.Add(Name:="nestedbookmark" & CStr(i), Range:=.Range)
End With
Next
Dim bmMain As Word.Bookmark
Dim mainBookmarkRange As Word.Range
Dim mainBookmarkRangeStart As Integer
Dim mainBookmarkRangeEnd As Integer
mainBookmarkRangeStart = Me.Bookmarks(1).Start
mainBookmarkRangeEnd = Me.Bookmarks(Me.Bookmarks.Count).End
mainBookmarkRange = Me.Range(Start:=mainBookmarkRangeStart, End:=mainBookmarkRangeEnd)
bmMain = Me.Bookmarks.Add(Name:="mainBookmark", Range:=mainBookmarkRange)
End Sub
Sub Assign3TablesToHostControlBookmarks()
'Word host control of Bookmark
'bookmarks must be destroyed before resetting the object
'added handler
Dim bm As Microsoft.Office.Tools.Word.Bookmark
'different from the interop one
Dim tb As Word.Table
Dim tbRange As Word.Range
Dim i As Integer
For i = 1 To 3
bm = Me.Controls.AddBookmark(range:=ThisApplication.Selection.Range, _
Name:="nestedBookmark" & CStr(i))
tb = bm.Range.Tables.Add(Range:=bm.Range, NumRows:=2, NumColumns:=2)
With tb
.Style = "Table Grid"
tbRange = .Range
With tbRange
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd)
.InsertParagraphAfter()
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd).Select()
End With
bm.Delete()
'this deletes the bookmark before it can be recreated
bm = Me.Controls.AddBookmark(range:=.Range, Name:="nestedBookmark" & CStr(i))
AddHandler bm.Selected, AddressOf bm_Selected
'handler added
End With
Next
Dim bmMain As Microsoft.Office.Tools.Word.Bookmark
Dim mainBookmarkRange As Word.Range
Dim mainBookmarkRangeStart As Integer
Dim mainBookmarkRangeEnd As Integer
mainBookmarkRangeStart = Me.Bookmarks(1).Start
mainBookmarkRangeEnd = Me.Bookmarks(Me.Bookmarks.Count).End
mainBookmarkRange = Me.Range(Start:=mainBookmarkRangeStart, End:=mainBookmarkRangeEnd)
bmMain = Me.Controls.AddBookmark(range:=mainBookmarkRange, Name:="mainBookmark")
End Sub
Private Sub bm_Selected(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.SelectionEventArgs)
MessageBox.Show("Hey, you have selected bookmark: " & sender.Name & ". " & _
"You did this at " & FormatDateTime(Date.Now(), DateFormat.LongTime))
End Sub