Results 1 to 8 of 8
  1. #1
    2 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Keeping rows of multiple tables from splitting across pages

    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!
    JimmyW
    Helena, MT

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,815
    Thanks
    0
    Thanked 166 Times in 153 Posts
    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
    [MS MVP - Word]

  4. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,464
    Thanks
    3
    Thanked 128 Times in 121 Posts
    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).
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #4
    2 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts
    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.
    JimmyW
    Helena, MT

  6. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,464
    Thanks
    3
    Thanked 128 Times in 121 Posts
    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
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #6
    2 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Question Now I want to set cell widths

    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.
    JimmyW
    Helena, MT

  8. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,815
    Thanks
    0
    Thanked 166 Times in 153 Posts
    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
    [MS MVP - Word]

  9. #8
    2 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    199
    Thanks
    8
    Thanked 0 Times in 0 Posts
    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.
    JimmyW
    Helena, MT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •