View Single Post
 
Old 06-05-2015, 11:36 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,471
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If your mailmerge is being run through code, you could use that code to call the cleanup routine. There are more efficient means of doing that, though.

The following code will delete all blank rows (except for those with vertically merged cells) in all tables in the active document.
Code:
Sub DelBlankRows()
Application.ScreenUpdating = False
Dim i As Long, j As Long
With ActiveDocument
  For i = .Tables.Count To 1 Step -1
    With .Tables(i)
      For j = .Rows.Count To 1 Step -1
        On Error Resume Next 'skip vertically merged cells
        With .Rows(j)
          If Trim(Replace(Replace(.Range.Text, Chr(13) & Chr(7), ""), Chr(160), "")) = "" Then .Delete
        End With
        On Error GoTo 0
      Next
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote