![]() |
|
#1
|
|||
|
|||
|
Hi I have multiple letters I need to email to recipients but I am using mail merge in a table format to pull in data from excel. Some letters needs all the line in the table while others only need half or even less. How do I prevent the empty rows to show in the final email, is there a marco or something else that can be used? I have attached table in word and excel where the info is pulled.
Thank you Last edited by nsaini01; 03-25-2022 at 06:57 AM. |
|
#2
|
||||
|
||||
|
There is no simple way to do this using out of the box mail merge to e-mail. You can however do it with E-Mail Merge Add-in if you run the following macro from the dialog:
Code:
Sub DelBlanks(oDoc As Document)
Dim oTable As Table
Dim oRow As Row
Dim oCell As Cell
Dim i As Long
Dim bTst As Boolean
Set oTable = oDoc.Tables(1)
For i = oTable.Rows.Count To 1 Step -1
bTst = False
Set oRow = oTable.Rows(i)
For Each oCell In oRow.Cells
If Len(oCell.Range) > 2 Then
bTst = True
Exit For
End If
Next oCell
If bTst = False Then oRow.Delete
Next i
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
is there any way without using mail merge toolkit
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge Template - remove blank rows in a table
|
Litmus | Mail Merge | 16 | 03-23-2022 01:42 PM |
| Remove blank lines in mail merge using table | wacobc | Mail Merge | 1 | 08-19-2021 09:10 PM |
Mail merge: remove empty rows when a field is not showed
|
Yarikh | Mail Merge | 4 | 09-23-2018 12:17 AM |
How to remove blank spaces between rows in a table,
|
Jamal NUMAN | Word | 2 | 04-28-2017 12:59 PM |
How to remove blank rows from a specified range?
|
Learner7 | Excel | 1 | 04-19-2011 02:45 AM |