Results 1 to 1 of 1
Thread: Code: Sub cmd_GlueWhiteSpace()
2001-03-15, 23:05 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
Code: Sub cmd_GlueWhiteSpace()
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.
If lngFirst >= ActiveDocument.Tables.Count Then ' There are no more tables
' 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 =_
' And if those characters are only white space
If boolOnlyWhiteSpace(rngTest.Text) Then_
' delete that intervening white space
Else ' there were non-WhiteSpace characters between the two tables
Else ' There were too many characters between the two tables