View Single Post
 
Old 04-04-2018, 07:09 AM
Cosmo Cosmo is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Try something based on:
Code:
Dim Tbl As Table, r As Long
' Remove empty rows
For Each Tbl In ActiveDocument.Tables
  With Tbl
    For r = .Rows.Count To 1 Step -1
      With .Rows(r)
        If Len(.Range.Text) = .Cells.Count * 2 + 2 Then
          .Delete
          If r = 1 Then Set Tbl = Nothing
        End If
      End With
    Next
  End With
  MsgBox Tbl Is Nothing
Next
That won't help me, since it will always set the table to nothing if the first row is empty. There may be other rows that were not deleted, and the table will need further processing.

Edit:
I could set a flag if the rowcount is 1 before deleting the row. That might work. Seems a bit hackish, though.
Reply With Quote