Stephen English was telling us:
Stephen English nous racontait que :
> I am iterating though one document (docIndex) and want to keep adding
> tables before a bookmark in another document (docAgenda).
[quoted text clipped - 10 lines]
> Selection.Move wdCharacter, -2
> Set tblAgenda = Selection.Range.Tables.Add(Selection.Range, 1, 2)
Try something like this to get a table sandwich between two ¶'s (So it will
not join with other tables around it)::
'_______________________________________
Dim docAgenda As Document
Dim rgeAgenda As Range
Dim tblAgenda As Table
Set docAgenda = ActiveDocument
Set rgeAgenda = docAgenda.Bookmarks("Start1").Range
With rgeAgenda
.MoveEnd wdCharacter, -1
Set tblAgenda = .Tables.Add(rgeAgenda, 1, 2)
With tblAgenda
.Cell(1, 1).Range.Text = "My first heading"
'etc
End With
.InsertParagraphAfter
End With
'_______________________________________
If you wan a table without the extra ¶'s. try this:
'_______________________________________
Dim docAgenda As Document
Dim rgeAgenda As Range
Dim tblAgenda As Table
Set docAgenda = ActiveDocument
Set rgeAgenda = docAgenda.Bookmarks("Start1").Range
With rgeAgenda
.MoveEnd wdCharacter, -1
Set tblAgenda = .Tables.Add(rgeAgenda, 1, 2)
With tblAgenda
.Cell(1, 1).Range.Text = "My first heading"
'etc
End With
.End = tblAgenda.Range.End
.Collapse wdCollapseEnd
.Delete
End With
'_______________________________________
The trick is not to use the Sselection object, but rather a Range object. It
is faster, more reliable and does not move the user selection.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Stephen English - 18 Oct 2006 02:39 GMT
Hi Jean-Guy
Thank you so much for the informative and educational response. I
understand ranges much better.
Kind regards
Stephen
> Stephen English was telling us:
> Stephen English nous racontait que :
[quoted text clipped - 61 lines]
> The trick is not to use the Sselection object, but rather a Range object. It
> is faster, more reliable and does not move the user selection.