• Keeping rows of multiple tables from splitting across pages

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Keeping rows of multiple tables from splitting across pages

    Author
    Topic
    #494895

    I know he basics of keeping my entire table on one page. However, I have 50, 1-row, 2-column tables, with 2 tables per page. I think that the way to do this is to uncheck the table option that otherwise allows rows to break across pages. I’d like to apply that choice to all 50 tables at once, but I can’t seem to get to Table Properties when multiple tables are selected. Thanks!

    Viewing 6 reply threads
    Author
    Replies
    • #1454237

      You cannot access those properties when something other than a table is part of the selection, hence each table needs to be process separately. Try the following macro:

      Code:
      Sub TableBreakFormat()
      Application.ScreenUpdating = False
      Dim wdTbl As Table
      For Each wdTbl In ActiveDocument.Tables
        wdTbl.Rows.AllowBreakAcrossPages = False
      Next
      Application.ScreenUpdating = True
      End Sub

      For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1454312

      As well as Macropod’s excellent macro, you may also be able to apply this setting by modifying the table style applied to each table (since it is likely all share the same table style).

    • #1454439

      Marcopod, you are a genius! Thank you both. I think that every table has the same style. I create an html report that contains tables, each of which includes a graphic and text description in a cell. I chose the one row/two column format. I open the index.html file with Word, break the links, and save the graphics in the Word file. I think that I know how to apply styles, but I don’t know which style would may accomplish the same thing, or how to apply the styles to every table in the file.

    • #1454469

      The benefit of modifying the style for your tables is that new tables created will already have the same table row setting applied so you wouldn’t need to continually run the macro to ensure all table rows are non-breaking.

      This macro can be customised further but it, combined with Macropod’s macro give you the basis of managing your tables.

      Code:
      Sub TableX()
        Dim sty As String, tbl As Table
        If ActiveDocument.Tables.Count > 0 Then
          sty = ActiveDocument.Tables(1).Style
          ActiveDocument.Styles(sty).Table.AllowBreakAcrossPage = False
          For Each tbl In ActiveDocument.Tables
            tbl.Style = sty
          Next tbl
        End If
      End Sub
    • #1455504

      I’m returning to this thread, as I have a similar issue. I want to set the cell width across multiple tables, each of which has two cells, perhaps to 4″. I played around with Marcopod’s macro for the breaks, but VB still is a challenge! Thanks.

    • #1455529

      Try something along the lines of:

      Code:
      Sub TableColumnFormat()
      Application.ScreenUpdating = False
      Dim wdTbl As Table
      For Each wdTbl In ActiveDocument.Tables
        wdTbl.AutoFitBehavior wdAutoFitFixed
        wdTbl.Columns.Width = InchesToPoints(4)
      Next
      Application.ScreenUpdating = True
      End Sub
      

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1455580

      Thanks again, Paul;! I have to find a source to learn some basic VB, particularly to do formatting tasks. I tried Kutools, but it doesn’t support some of the stuff that I need.

    Viewing 6 reply threads
    Reply To: Keeping rows of multiple tables from splitting across pages

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: