Blank Lines Numbered on Merge

L

L Losser

Hello. I am getting undesirable results while performing a merge from an
Access DB into an existing MS Word Template using MS VB 6.0 (& Office 2000
Professional).



One of the Database fields being imported can contain 1 to 10 paragraphs of
information separated by hard-returns. During the merge, this information
is imported into an existing numbered list. The sequence of numbers is
correct (i.e. - the existing list ends with item number 3 and the new merge
data starts numerically with item 4), but the blank lines between each
paragraph are being numbered as well. Here is an example:



1.. Paragraph 1 Text


2.. Paragraph 2 Text


3.. Paragraph 3 Text


4.. Merged Paragraph 4 Text
5..
6.. Merged Paragraph 5 Text
7..
8.. Merged Paragraph Text etc.


The desired behavior would be for the merged paragraphs to continue the same
sequence w/o the linefeeds being number.



Has anybody else come across this issue? I am hoping someone with more
experience in this area has an easy solution that I am missing.





Thank you and please let me know if you have any questions,

Steve Mack
 
S

Suzanne S. Barnhill

Where do the blank lines come from? If they're in the mail merge main
document, omit them and use Space Before/After instead. If they're coming
from the data source (as I suspect), then there are a couple of things to
try:

1. Make sure you have Word set to suppress blank lines (that is, delete
paragraphs when the data field is empty).

2. Make the paragraph break part of the TrueText of any IF field you're
using; if there is no data, there will be no paragraph.
 
S

Steve Mack

Thank you Suzanne for your reply.

"Where do the blank lines come from?"
Yes, they are coming from the Data Source

The problem isn't occurring when the dataset's are empty, but from the blank
lines within the dataset paragraphs.

I was able to create a Macro to remedy the numbering sequence. This seems
to be the best solution I could find so far. Not sure yet if I can execute
a Word Macro from VB yet.


Steve Mack
 
D

Daiya Mitchell

Wouldn't a find and replace to find ^p^p and replace with ^p (find 2
paragraph marks ¶ in a row, replace with 1) work? To get rid of the empty
paragraphs. In the Word doc, after the merge.

For macro help, you should look for a Word group with vba or programming in
the name, by the way. Word macros use VB for Applications 6.0, so I think
it should work but don't know enough to know.
 
S

Steve Mack

Thank you Daiya,

Yes, the macro is a simple search and replace. In case anyone comes across
this thread and is looking for the code to execute a macro using ole here is
the code (for Word 2000):

wrdApp.Run "<macro name>"


Steve Mack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top