Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-29-2020, 11:49 PM
macropod's Avatar
macropod macropod is offline Table Merge _ Auto Delete Blank Lines (without Data) Windows 7 64bit Table Merge _ Auto Delete Blank Lines (without Data) Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,383
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

Try:
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim Tbl As Table, c As Long, r As Long, StrVal As String
ActiveDocument.MailMerge.Execute
For Each Tbl In ActiveDocument.Tables
  With Tbl
    For r = .Rows.Count To 1 Step -1
      If Len(.Rows(r).Range.Text) = .Rows(r).Cells.Count * 2 + 2 Then
          .Rows(r).Delete
      Else
        For c = 3 To 4
          StrVal = Split(.Cell(r, c).Range.Text, vbCr)(0)
          If InStr(StrVal, "") > 0 Then
            StrVal = Replace(Replace(Replace(StrVal, ".", "|"), ",", "."), "|", ",")
            .Cell(r, c).Range.Text = StrVal
          End If
        Next
      End If
    Next
  End With
Next
Application.ScreenUpdating = True
End Sub
For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Table Merge _ Auto Delete Blank Lines (without Data) Blank Lines in Mail Merge - Other Options not working cluyster1127 Mail Merge 13 12-11-2019 01:05 PM
Table Merge _ Auto Delete Blank Lines (without Data) Removing Lines / Tables with Blank Data Crosby87 Mail Merge 33 07-16-2019 02:24 AM
Table Merge _ Auto Delete Blank Lines (without Data) I am getting blank lines with Mail Merge rtcary Mail Merge 1 01-20-2018 02:07 PM
Table Merge _ Auto Delete Blank Lines (without Data) Select and Delete 2 lines after each blank line Ziad El Hachem Word VBA 4 03-21-2017 06:55 PM
Table Merge _ Auto Delete Blank Lines (without Data) Eliminating blank lines in mail merge (labels) BeerStud Mail Merge 1 11-28-2014 06:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft