none
Macro to insert page break between tables RRS feed

  • Question

  • I have 117 tables that I need to insert a page break between each.  Does anyone have a macro that can do this?  Thanks!!
    Monday, June 23, 2014 8:11 PM

Answers

  • Try

    Sub InsertPageBreaks()
        Dim i As Long
        Dim rng As Range
        Application.ScreenUpdating = False
        For i = 1 To ActiveDocument.Tables.Count - 1
            Set rng = ActiveDocument.Tables(i).Range
            rng.Collapse Direction:=wdCollapseEnd
            rng.InsertBreak
        Next i
        Application.ScreenUpdating = True
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, June 23, 2014 9:21 PM

All replies

  • Try

    Sub InsertPageBreaks()
        Dim i As Long
        Dim rng As Range
        Application.ScreenUpdating = False
        For i = 1 To ActiveDocument.Tables.Count - 1
            Set rng = ActiveDocument.Tables(i).Range
            rng.Collapse Direction:=wdCollapseEnd
            rng.InsertBreak
        Next i
        Application.ScreenUpdating = True
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, June 23, 2014 9:21 PM
  • Worked perfect!!!  Thanks so much huge time saver!
    Monday, June 23, 2014 10:02 PM