Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
![]()
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 |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to "flip" pages in "Reading Layout". | Microsoft Word Help | |||
Can I modify a field causing global change to all "linked" fields | Microsoft Word Help | |||
How do I change page range "All" to "current Pages" in print menu | Microsoft Word Help | |||
"Print current page" should have a "+n pages" field. | Microsoft Word Help | |||
"changes have been made that affect the global template" | New Users |