Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Mailmerge: remove blank lines created by carriage return in datas.

Geek News

Mailmerge: remove blank lines created by carriage return in datas.
SteveM 6/26/2007 11:43:00 AM
I want to print some mailing labels but I have blank lines in the address
fields that are created from carriage returns in the datasource.

How do I stop these blank lines displaying on my labels?
RE: Mailmerge: remove blank lines created by carriage return in datas.
SteveM 6/26/2007 1:41:01 PM
To explain further:

The fields from my datasource (an Excel file) are Address, Town, County etc.
The Address field is multiline and some users have added a carriage return
at the end of the street address info causing a blank line between
Address/Town.

So, I need to trim off this character from the end of the data in this field
if it is there.

Any ideas?

Steve
Re: Mailmerge: remove blank lines created by carriage return in datas.
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 6/26/2007 5:02:37 PM
Your best best is probably to create an Excel macro that fixes the data
before the merge. (You'd probably be better off asking about that in an
Excel group, too). However, you /might/ be able to do this in Word by
opening the data source from within Word VBA and using an SQL function that
replaces two CR (or CRLF, or whatever it actually is) characters by a single
one. I don't know in this case whether that is workable, but if you want to
go that route and can't figure out the VBA or the necessary SQL, ask again
and I'll have a closer look. Also, that approach own't work if for other
reasons you have to open the worksheet using DDE (the default in Word 2000
and earlier).

Peter Jamieson
"SteveM" <SteveM[ at ]discussions.microsoft.com> wrote in message
news:1F77B31C-A86A-44BD-A407-DA5C2031554E[ at ]microsoft.com...
[Quoted Text]
> To explain further:
>
> The fields from my datasource (an Excel file) are Address, Town, County
> etc.
> The Address field is multiline and some users have added a carriage return
> at the end of the street address info causing a blank line between
> Address/Town.
>
> So, I need to trim off this character from the end of the data in this
> field
> if it is there.
>
> Any ideas?
>
> Steve

Re: Mailmerge: remove blank lines created by carriage return in da
SteveM 6/26/2007 5:16:00 PM
Thanks for the reply Peter.

The Excel worksheet was created from a query in Access. I solved the problem
by modifying the query to detect Chr(13) & Chr(10) at the end of the data and
return only the data portion of the field prior to their occurrence.

Steve

"Peter Jamieson" wrote:

[Quoted Text]
> Your best best is probably to create an Excel macro that fixes the data
> before the merge. (You'd probably be better off asking about that in an
> Excel group, too). However, you /might/ be able to do this in Word by
> opening the data source from within Word VBA and using an SQL function that
> replaces two CR (or CRLF, or whatever it actually is) characters by a single
> one. I don't know in this case whether that is workable, but if you want to
> go that route and can't figure out the VBA or the necessary SQL, ask again
> and I'll have a closer look. Also, that approach own't work if for other
> reasons you have to open the worksheet using DDE (the default in Word 2000
> and earlier).
>
> Peter Jamieson
> "SteveM" <SteveM[ at ]discussions.microsoft.com> wrote in message
> news:1F77B31C-A86A-44BD-A407-DA5C2031554E[ at ]microsoft.com...
> > To explain further:
> >
> > The fields from my datasource (an Excel file) are Address, Town, County
> > etc.
> > The Address field is multiline and some users have added a carriage return
> > at the end of the street address info causing a blank line between
> > Address/Town.
> >
> > So, I need to trim off this character from the end of the data in this
> > field
> > if it is there.
> >
> > Any ideas?
> >
> > Steve
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net