View Single Post
 
Old 11-05-2020, 09:52 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
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

As this appears to be the result of a mail merge, by using https://www.gmayor.com/MergeAndSplit.htm or
https://www.gmayor.com/individual_merge_letters.htm. with only a minor change you could run the macro from the process on the fly:
Code:
Sub FixTable(oDoc As Document)
'Graham Mayor - https://www.gmayor.com - Last updated - 06 Nov 2020
Dim oTable As Table
Dim i As Integer, j As Integer
    For j = oDoc.Tables.Count To 1 Step -1
        Set oTable = oDoc.Tables(j)
        For i = oTable.Rows.Count To 1 Step -1
            oTable.Rows(i).Select
            If Len(oTable.Rows(i).Range) <= 6 Then
                oTable.Rows(i).Delete
            End If
        Next i
        If oTable.Rows.Last.Cells.Count = 4 Then
            oTable.Rows.Last.Delete
        End If
    Next j
    Set oTable = Nothing
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