I have a mailing in which I need to produce a two-page letter for some entries in a data file but not for others. Basically, I have a list of countries, and those in the data in the listed countries should print but anyone else shouldn't. The list of countries
is too long to use the edit recipient list/filter/query options route (19 currently, though it may grow longer before we go into production). I tried a string of nested IF statements to check the country's name with further IFs within them to select the correct
letter (there are multiple versions, based on another code in the data) and then INCLUDETEXT to pull the text into the document. This works great, except that every time there's a record in the data that shouldn't print, the merge produces a blank page.
Is there any way to either suppress the blank page during the merge or to seek and destroy blank pages in the merged document before printing? I'd rather not have to resort to manually stripping out the records we don't want from the data, because we'll need
to do this repeatedly with a number of very large files, each with hundreds of records.
Is the blank page a separate Section in the document.
If so, running a macro containing the following code should remove the blank pages
Dim i As Long
With ActiveDocument
For i = .Sections.count To 1 Step -1
If Len(.Sections(i).range) = 2 Then
.Sections(i).range.Delete
End If
Next i
End With
Hope this helps, Doug Robbins - MVP Office Apps & Services (Word) dougrobbinsmvp@gmail.com It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy
Was this reply helpful?
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.