Auto Deleting Space in Merge Doc when No Data

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

Hi everybody. I have a Word document (Word 2000) with several lines of items
and amounts. Each item and amount are separate, individual merge fields,
example Item1, Amount1, Item2, Amount2, etc..

If there is no data for an item and an amount, is there a way to
automatically delete the blank line from the document, the other lines are
re-adjusted, and no blank space prints? Would I need to use a macro for this
or is there some built-in functionality that would take care of deleting the
blank space?

Thanks,

Kim Finleyson

Kim@[nospam]PCSSInc.com
 
C

Cindy M -WordMVP-

Hi Msnews.microsoft.com,
I have a Word document (Word 2000) with several lines of items
and amounts. Each item and amount are separate, individual merge fields,
example Item1, Amount1, Item2, Amount2, etc..

If there is no data for an item and an amount, is there a way to
automatically delete the blank line from the document, the other lines are
re-adjusted, and no blank space prints? Would I need to use a macro for this
or is there some built-in functionality that would take care of deleting the
blank space?
If the merge field is the only field in the paragraph, then Word should take
care of suppressing the blank line, itself. In Word 2000, this option can be
turned on/off, however, so you do want to check in the dialog box you get when
you click the "Mail merge..." button on the merge toolbar.

If other characters are in the same line (even a space), then you need to use
an IF field to evaluate the content and control the display. The IF field you
need would probably look something like this:

{ IF { Mergefield Item } <> "" "{ If { Mergefield Amount } <> 0 "{ Mergefield
Item } { Mergefield Amount }¶
" "" }" "" }

Ctrl+F9 to insert the field brackets: { }
Press ENTER where you see ¶ in the equation above
Alt+F9 to turn the field codes on/off
F9 to force the fields to update (or move to another record)

You'll notice that the formula checks for an empty result / a zero result. If
either is empty, then "nothing" is displayed. If both are true, then the
mergefields are displayed, with a paragraph return. This means that all the IF
combinations should be inserted into one paragraph, and additional paragraphs
will only be generated as required. IOW, start the next IF combination
immediately after the closing bracket of the previous one.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
K

Kim Finleyson

Thanks Cindy! I actually found the solution with the "IF" field the same day
I posted this message -- ironically, I found the solution on your website
before you posted your reply. I wanted to mention that this was my first
attempt at using Outlook Express to post a message (I've gone through the
web browser in the past), so did not know I had my return name set as
"msnews.microsoft.com". I fixed this now, so my posts will have the correct
return name.

By the way, the question I asked was actually forwarded to me from one of
our programmers at our company. Our application uses Word merges intensely
to allow users to generate custom forms/notices, but unfortunately, the code
for the merges was written some time ago and I believe may not be taking
advantage of Word's improved functionality. I volunteered to help with these
problems so am trying to familiarize myself with the Word merge process and
apply it to what we are doing here. Would you happen to know of any document
that traces how Word merge functionality has changed throughout the
different versions of Word (pre-Word 97 through 2003)? If so, I would
appreciate any links that may explain how this process has changed over the
years and what improvements were added.

Thanks again!

Cordially,
Kim Finleyson

Technical Communications
PCSSInc.com
Kim@[nospam]PCSSInc.com
 
C

Cindy M -WordMVP-

Hi Kim,
Would you happen to know of any document
that traces how Word merge functionality has changed throughout the
different versions of Word (pre-Word 97 through 2003)?
I don't know of any documents on this, no. Quite a bit is stored in
my memory :)

Word 2.0 -> Word 6.0
--------------------
Introduction of the Mail Merge Helper interface. More ODBC drivers;
plus integration with MS Query. Inclusion of the Avery Label Wizard.
The buttons on the mail merge toolbar, most especially, the list of
merge fields and the list of "Word fields", Data preview, record
search, error check...

Then there really weren't any changes for quite a long time, except
for additional ODBC drivers, as they became available in MDAC. If
anything, mail merge actually deteriorated as it didn't keep up with
developments on the database side. Somewhere in the time span (moving
to Word 97, I think) is when they started sticking section breaks in
after every lable page. "Find record" was also broken, going into
Word 97.

Word 6.0 -> Word 2002/2003
--------------------------
Lot of changes going into Word 2002, although not in the basic way
mail merge really works
- OLE DB as the default connection method
- the new interfaces (Mail Merge Wizard, Recipients dialog box)
- *.mdb file as "native" Word data source type
- Address Block and Greeting Line fields
- the new switches that let you specify "text before" and "text
after" within merge fields
- "Open Data Source" defaulting to "My data sources"
- in VBA, the MailMerge events were introduced
- changing the naming of merging with no new page section breaks
from "catalog" to "dirctory"
- "Find record" was finally fixed, but only in the UI, not for
VBA
- ODBC is no longer offered as a connection method for text
files (unless installing over an older version, where this was
available; can be called up if one knows how, though)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 
K

Kim Finleyson

Cindy: Thanks a lot! I am asked Word questions quite often at my company...I
will forward this information on as applicable.

Sincerely,

Kim Finleyson
 
C

Cindy M -WordMVP-

Hi Kim,
I am asked Word questions quite often at my company...I
will forward this information on as applicable.
One more change occurred to me, last night:

Using an AddressBook (Schedule+, Outlook, etc.) was
introduced in Office 95 :)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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