Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
NL_Derek NL_Derek is offline
external usenet poster
 
Posts: 1
Default Global inhibit "Allow row to break across pages"

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

  #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

  #3   Report Post  
Posted to microsoft.public.word.pagelayout
NL_Derek[_2_] NL_Derek[_2_] is offline
external usenet poster
 
Posts: 1
Default Global inhibit "Allow row to break across pages"

Thanks Steven, you've put me on a good track. I made a macro as follows:

Sub ForceUnbrokenRows()

Dim ThisTable As Table
Dim TableNumber As Long
Dim RowNumber As Long

For TableNumber = 1 To ActiveDocument.Tables.Count
Set ThisTable = ActiveDocument.Tables(TableNumber)
For RowNumber = 1 To ThisTable.Rows.Count
ThisTable.Rows(RowNumber).AllowBreakAcrossPages = False
Next RowNumber
Next TableNumber

End Sub

.... and it worked until it encountered a table with vertically merged cells,
when I got error 5991 (Cannot access individual rows...)

Now very few tables in my project have vertically merged cells, so I can
afford to just skip such tables. But how do I detect this?
I guess I need to add something like:

If ThisTable.HasVerticallyMergedCells = True Then
Next TableNumber
Endif

I don't know VBasic so I don't know whether this is valid syntax. I looked
around in the object browser but couldn't find anything about vertical
merging.
Can you (or anyone else) please help?

--- Derek

"StevenM" wrote:

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

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to "flip" pages in "Reading Layout". sheana Microsoft Word Help 1 July 2nd 08 11:46 PM
Can I modify a field causing global change to all "linked" fields ScriptOhio Microsoft Word Help 1 June 5th 08 09:25 PM
How do I change page range "All" to "current Pages" in print menu Shiv Microsoft Word Help 1 May 4th 07 01:13 PM
"Print current page" should have a "+n pages" field. rawahoho Microsoft Word Help 5 November 16th 06 03:26 PM
"changes have been made that affect the global template" Stan Brown New Users 1 April 5th 06 05:18 AM


All times are GMT +1. The time now is 01:50 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"