View Single Post
  #2   Report Post  
Posted to microsoft.public.word.pagelayout
StevenM[_2_] StevenM[_2_] is offline
external usenet poster
 
Posts: 169
Default Global inhibit "Allow row to break across pages"

To: NL Derek,

Try running one of the following macros.

'
' Keep a Table on same page
' Put cursor inside table and run this macro
'
Sub KeepTableOnOnePage()
Dim oTable As Table
Dim i As Long
Dim rows As Long

If Selection.Information(wdWithInTable) = False Then
MsgBox "The cursor must be positioned in the table."
Else
Set oTable = Selection.Tables(1)
oTable.rows.AllowBreakAcrossPages = False
rows = oTable.rows.Count - 1
For i = 1 To rows
oTable.rows(i).Range.ParagraphFormat.KeepWithNext = True
Next i
End If
End Sub

'
' Keep Each Table On One Page
'
Sub KeepEachTableOnOnePage()
Dim oTable As Table
Dim i As Long
Dim nTables As Long
Dim nNum As Long

nTables = ActiveDocument.Tables.Count
If nTables = 0 Then Exit Sub
For nNum = 1 To nTables
Application.StatusBar = nTables & ":" & nNum
Set oTable = ActiveDocument.Tables(nNum)
oTable.rows.AllowBreakAcrossPages = False
For i = 1 To (oTable.rows.Count - 1)
oTable.rows(i).Range.ParagraphFormat.KeepWithNext = True
Next i
Next nNum
End Sub

Steven Craig Miller


"NL_Derek" wrote:

I have a Word document generated by another application (RoboHelp) which
contains some tables.
I do not want rows of these tables to break across pages; is there any way I
can globally clear the option Table TableProperties Row
AllowRowToBreakAcrossPages.
At present I have to manually look for breaking rows and clear the option
manually each time.
I use Word 2003 under Windows XP

--- Derek