Results 1 to 6 of 6

Thread: Executing macro on each subsequent page/table

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    See https://www.msofficeforums.com/word-...age-table.html
    Please crosspost correctly
    
    Sub SortTable()  'Set the table object = the table with the selection
      On Error GoTo Err_Handler:
      For Each m_Otbl In ActiveDocument.Tables
        'Table must be uniform (not split or merged cells)
        If Not m_Otbl.Uniform Then
            MsgBox "The selected table has split or merge cells and cannot be sorted with this procedure", vbInformation + vbOKOnly, "Non-Uniform Table"
            Exit Sub
        End If
        TableSort_Re_Sort
      Next m_Otbl
      Exit Sub
    Err_Handler:
    End Sub
    Last edited by Aussiebear; 07-22-2023 at 06:41 AM. Reason: Apologies Graham but I've included your code here
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

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