This is what I use to glue tables together. It makes use of (what else!) the INI file functions and the strgetWhiteSpace function.


<pre>Public Sub cmd_GlueWhiteSpace()
' Procedure : cmd_GlueWhiteSpace
' Description: Join this and the following table separated by white space.
' By: Chris Greaves Inc.
' Inputs: None
' Returns: None
' Assumes: None.
' Side Effects: The named document contents may change.
' Tested: By a call from the User.

' First find out where we are!
Dim lngFirst As Long
lngFirst = lngGetTableIndex
If lngFirst = 0 Then ' we are not IN a table.
Call errMustBeInTable
Else
If lngFirst >= ActiveDocument.Tables.Count Then ' There are no more tables
Else
' Now obtain the ranges of adjoining tables
Dim rngFirst As Range
Dim rngNext As Range
Set rngFirst = ActiveDocument.Tables(lngFirst).Range
Set rngNext = ActiveDocument.Tables(lngFirst + 1).Range
' If separated by less than a specified number of characters
If (rngNext.Start - rngFirst.End) <_
Val(strGp(strcApplication, strcModule, strcGap, strcDefaultGap)) Then
Dim rngTest As Range
Set rngTest =_
ActiveDocument.Range(Start:=(rngFirst.End), End:=(rngNext.Start))
' And if those characters are only white space
If boolOnlyWhiteSpace(rngTest.Text) Then_
' delete that intervening white space
rngTest.Select
rngTest.Delete
Else ' there were non-WhiteSpace characters between the two tables
End If
Else ' There were too many characters between the two tables
End If
End If
End If
End Sub
</pre>