Thread: [Solved] Keeping Table on One Page
View Single Post
 
Old 08-22-2016, 05:02 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub KeepRowsTogether()
Dim oTbl As Table, oCel As Cell
For Each oTbl In ActiveDocument.Tables
  With oTbl
    .Range.Paragraphs.KeepWithNext = True
    If .Uniform = True Then
      For Each oCel In .Rows.Last.Range.Cells
        oCel.Range.Paragraphs.Last.KeepWithNext = False
      Next oCel
    Else
      Set oCel = .Range.Cells(.Range.Cells.Count)
      Do While oCel.ColumnIndex > 1
        oCel.Range.Paragraphs.Last.KeepWithNext = False
        Set oCel = oCel.Previous
      Loop
      oCel.Range.Paragraphs.Last.KeepWithNext = False
    End If
  End With
Next oTbl
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote