Thread: [Solved] Keeping Table on One Page
View Single Post
 
Old 04-12-2011, 08:28 AM
SCMiller SCMiller is offline Windows Vista Office 2007
Novice
 
Join Date: Apr 2011
Posts: 4
SCMiller is on a distinguished road
Default Keeping Table on One Page

I'm wanted to keep each table on one page. I'm missing something here. Can someone give me some help?

Code:
Sub KeepRowsTogether()
    Dim tbl As Table
    Dim nPara As Long, i As Long
    
    For Each tbl In ActiveDocument.Tables
        nPara = tbl.Range.Paragraphs.Count
        For i = 1 To (nPara - 1)
            tbl.Range.Paragraphs(i).KeepWithNext
        Next i
    Next tbl
End Sub
Reply With Quote