View Single Post
 
Old 12-02-2020, 10:04 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,103
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 of
Default

It would be a simple process to create a macro that checks each row. If you use my merge add-in E-Mail Merge Add-in to merge to separate documents, you could use the following macro to remove them on the fly
Code:
Sub ClearEmpty(oDoc As Document)
Dim oTable As Table
Dim iRow As Integer, iCol As Integer
Dim bFound As Boolean
    With oDoc
        For Each oTable In oDoc.Tables
            If oTable.Columns.Count = 5 Then
                For iRow = oTable.Rows.Count To 2 Step -1
                    bFound = False
                    For iCol = 2 To oTable.Rows(iRow).Cells.Count
                        If Len(oTable.Rows(iRow).Cells(iCol).Range) > 2 Then
                            bFound = True
                            Exit For
                        End If
                    Next iCol
                    If bFound = False Then oTable.Rows(iRow).Delete
                    DoEvents
                Next iRow
            End If
        Next oTable
    End With
End Sub
If you want to run the macro on your already merged document then call it using
Code:
Sub Macro1()
ClearEmpty ActiveDocument
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