View Single Post
 
Old 07-21-2023, 11:15 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Greg's code operates on the selected table. Change it to sequentially process all the tables e.g.
Code:
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
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote