Member Avatar for Geek-Master

The problem that I am facing is that Word 2007 is adding spaces in a mail merge when there isn't a value from an excel document.

<<FirstName>> <<MiddleName>> <<LastName>>

I've placed spaces in between the template place holders to seperate the names. However, when a record doesn't have a middle name, there will be two spaces in between the first and last name. I remember previous versions of word removing the "extra" spaces in the past. However 2007 doesn't do this for me automatically, instead it adds an extra space when the datasource is blank/null.

Has anyone else seen this happen?

Thanks in advance

Before you start your merge, do the following:

1. Right click any white space in your document and select Paragraph

2 The Paragraph properties will pop up.

3. Select “Don’t add space between paragraphs of the same style

4. Click OK, Continue your merge.

Member Avatar for Geek-Master

I noticed that I can also default that setting for future documents.

Thanks I'll try it out.

you can also clicl on the paragraph icons in word, believe it's the second one from the default ( at work Now so i am not using 2007) but use at home. its the same thing when you try to type a regular document.

Member Avatar for Geek-Master

Actually this doesn't fix what I'm working with. However it does fix that extra line that is created when hitting the enter key. We had another fix, which is to change the style to use word 2003 instead of 2007. Thanks for showing me how to fix that the right way.

My problem comes from doing a mail merge from an excel list of addresses to several lables. The template is like so.

<<first_name>>_<<middle_name>>_<<last_name>>

Where the underscore between the arrows represents one spacing since the arrows makes it hard to see them. Now when we merge the document with the data from excel, an extra space is created if for say middle_name is null or empty. How do I prevent extra spaces from showing up between field names. This use to not happen in Word 2003. Any ideas?

Thanks

You might have to use an IF field

{ IF { MERGEFIELD Title } = "" "" "{ MERGEFIELD Title } " }{ IF { MERGEFIELD FirstName } = "" "" "{ MERGEFIELD FirsName } " }

So if title is blank, add nothing, if not, title and space AFTER. The double quotes acts as a NULL-SPACE "" where " " would be a space.

You could also do a Find and Replace for double spaces, in find press space bar twice, in replace press once or leave blank.

If your using Excel for the data source, Insert a column and name the field "Full Name." Fill down the column with the following formula:

=TRIM(SUBSTITUTE(CONCATENATE(A2, " ", B2, " ", C2), "  ", " "))

hope this helps.

If your first and last name are in the same cell in excel and you try to merge into word using the "last name field" it will create an unnecessary indent space. MS Office thinks there should be a space there because it’s a last name and there is always a space between first and last.

Either separate the first and last name in excel and re-merge OR match the field to the “first name” in word and the space should disappear.

If you are working on a Mac, try this:

If it won't single space, HIGHLIGHT label or doc, go to FORMAT then PARAGRAPH and set spacing Before and After at zero and Single; go to Line Breaks and check the box next to "Keep Lines Together" have that be the ONLY box checked, hit okay.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.