Sub test()
Dim oRow As Row
Dim oCell As Cell
Dim oTable As Table
Dim nRowIndex As Long
Dim nCellCount As Long
Dim i As Long
For Each oTable In ActiveDocument.Tables
For nRowIndex = oTable.Rows.Count To 1 Step -1
Set oRow = oTable.Rows(nRowIndex)
nCellCount = oRow.Cells.Count
If oRow.Range.Text = EmptyRow(nCellCount) Then ' empty
oRow.Delete
Else
Debug.Print nRowIndex, "is not empty"
End If
Set oRow = Nothing
Next nRowIndex
Next oTable
Set oRow = Nothing
Set oTable = Nothing
End Sub
Private Function EmptyRow(ByVal nCellCount As Long) As String
Dim i As Long
For i = 1 To (nCellCount + 1)
EmptyRow = EmptyRow & Chr$(13) & Chr$(7)
Next i
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.