Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
PA PA is offline
external usenet poster
 
Posts: 88
Default Fix a txt data file

My company has decided to download selected customer information, monthly,
from one of our AS400 mainframes into a text file and then do a mail merge
with Word. There will be approximately 500 letters to be generated, each
month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and the
city field in the data, so that there is an extra line in the address. I
opened the text file in Word and see a paragraph mark, forcing city field to
the next line in the word file. The inside address will therefore not fit
properly in the window envelope. The field labels in the first row are on
one line, the problem begins in the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Fix a txt data file

If you are trying to use the addressblock field, don't! Just place the
address fields as you require them.
You can conditionally insert Address2 if necessary to avoid empty lines when
the field has no data eg
{Mergefield Address1}{If {Mergefield Address2} "" "
{Mergefield Address2}
(Mergefield City} etc


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PA wrote:
My company has decided to download selected customer information,
monthly, from one of our AS400 mainframes into a text file and then
do a mail merge with Word. There will be approximately 500 letters
to be generated, each month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and
the city field in the data, so that there is an extra line in the
address. I opened the text file in Word and see a paragraph mark,
forcing city field to the next line in the word file. The inside
address will therefore not fit properly in the window envelope. The
field labels in the first row are on one line, the problem begins in
the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
PA PA is offline
external usenet poster
 
Posts: 88
Default Fix a txt data file

Thank you Graham, but I must not have explained completely.

I am not using the address block. I have the fields set up as you suggest,
but if I open the data file (txt file) in Word and turn on the non-printing
characters, there is a pilcrow after Address2, and the City, State and Zip
field are unnecessarily forced to the next row. This is occuring in each
record. I am thus getting an extra row whether Address2 is populated or is
null.
If I import the data into Excel, field headers are on row1, the two name
fields and address fields are on row 2 and city, state and zip are on row 3.
Subsequent records likewise take two rows.

"Graham Mayor" wrote:

If you are trying to use the addressblock field, don't! Just place the
address fields as you require them.
You can conditionally insert Address2 if necessary to avoid empty lines when
the field has no data eg
{Mergefield Address1}{If {Mergefield Address2} "" "
{Mergefield Address2}
(Mergefield City} etc


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PA wrote:
My company has decided to download selected customer information,
monthly, from one of our AS400 mainframes into a text file and then
do a mail merge with Word. There will be approximately 500 letters
to be generated, each month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and
the city field in the data, so that there is an extra line in the
address. I opened the text file in Word and see a paragraph mark,
forcing city field to the next line in the word file. The inside
address will therefore not fit properly in the window envelope. The
field labels in the first row are on one line, the problem begins in
the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Fix a txt data file

You could consider using WOrd find and replace to remove the additional
return, e.g. if you have

field1,field2,address,
city,state,zip
field1,field2,address,
city,state,zip
field1,field2,address,
city,state,zip

then you could find ",^p" and replace with "," (both expressions without
quotes)

Obviously if you are trying to automate then that would require an extrea
set of steps and there would probably be a better way to do it. But if you
are actually getting

field1,field2,address
city,state,zip

then things are a bit different. What is in the field that the AS400 people
are exporting from?


--
Peter Jamieson
http://tips.pjmsn.me.uk

"PA" wrote in message
...
Thank you Graham, but I must not have explained completely.

I am not using the address block. I have the fields set up as you
suggest,
but if I open the data file (txt file) in Word and turn on the
non-printing
characters, there is a pilcrow after Address2, and the City, State and
Zip
field are unnecessarily forced to the next row. This is occuring in each
record. I am thus getting an extra row whether Address2 is populated or
is
null.
If I import the data into Excel, field headers are on row1, the two name
fields and address fields are on row 2 and city, state and zip are on row
3.
Subsequent records likewise take two rows.

"Graham Mayor" wrote:

If you are trying to use the addressblock field, don't! Just place the
address fields as you require them.
You can conditionally insert Address2 if necessary to avoid empty lines
when
the field has no data eg
{Mergefield Address1}{If {Mergefield Address2} "" "
{Mergefield Address2}
(Mergefield City} etc


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PA wrote:
My company has decided to download selected customer information,
monthly, from one of our AS400 mainframes into a text file and then
do a mail merge with Word. There will be approximately 500 letters
to be generated, each month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and
the city field in the data, so that there is an extra line in the
address. I opened the text file in Word and see a paragraph mark,
forcing city field to the next line in the word file. The inside
address will therefore not fit properly in the window envelope. The
field labels in the first row are on one line, the problem begins in
the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?





  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Fix a txt data file

As an alternative to Peter's method

Dim i As Long
With ActiveDocument
For i = .Paragraphs.Count - 1 To 1 Step -2
.Paragraphs(i).Range.Characters(.Paragraphs(i).Ran ge.Characters.Count).Delete
Next i
End With

or, if there is no comma at the end of the first row of data for each
record, use

Dim i As Long
With ActiveDocument
For i = .Paragraphs.Count - 1 To 1 Step -2
.Paragraphs(i + 1).Range.InsertBefore ","
.Paragraphs(i).Range.Characters(.Paragraphs(i).Ran ge.Characters.Count).Delete
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"PA" wrote in message
...
Thank you Graham, but I must not have explained completely.

I am not using the address block. I have the fields set up as you
suggest,
but if I open the data file (txt file) in Word and turn on the
non-printing
characters, there is a pilcrow after Address2, and the City, State and
Zip
field are unnecessarily forced to the next row. This is occuring in each
record. I am thus getting an extra row whether Address2 is populated or
is
null.
If I import the data into Excel, field headers are on row1, the two name
fields and address fields are on row 2 and city, state and zip are on row
3.
Subsequent records likewise take two rows.

"Graham Mayor" wrote:

If you are trying to use the addressblock field, don't! Just place the
address fields as you require them.
You can conditionally insert Address2 if necessary to avoid empty lines
when
the field has no data eg
{Mergefield Address1}{If {Mergefield Address2} "" "
{Mergefield Address2}
(Mergefield City} etc


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


PA wrote:
My company has decided to download selected customer information,
monthly, from one of our AS400 mainframes into a text file and then
do a mail merge with Word. There will be approximately 500 letters
to be generated, each month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and
the city field in the data, so that there is an extra line in the
address. I opened the text file in Word and see a paragraph mark,
forcing city field to the next line in the word file. The inside
address will therefore not fit properly in the window envelope. The
field labels in the first row are on one line, the problem begins in
the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?








  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
PA PA is offline
external usenet poster
 
Posts: 88
Default Fix a txt data file

Thank you all for your suggestions.
I will give it another attempt tomorrow when returning to the office.

"PA" wrote:

My company has decided to download selected customer information, monthly,
from one of our AS400 mainframes into a text file and then do a mail merge
with Word. There will be approximately 500 letters to be generated, each
month.
The fields to be used a
"Fname","Lname","Address1","Address2","City","Stat e","Zip"
The problem is, there is a line break between the address2 field and the
city field in the data, so that there is an extra line in the address. I
opened the text file in Word and see a paragraph mark, forcing city field to
the next line in the word file. The inside address will therefore not fit
properly in the window envelope. The field labels in the first row are on
one line, the problem begins in the data itself.
I hope this explanation is understandable, the cause is certainly not.
How can I correct this problem?

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert label file to data base file? preachershoney Microsoft Word Help 1 November 17th 06 09:49 PM
How to re-connect merged data (excel file) in the word file jose Mailmerge 1 May 11th 06 02:45 PM
Merge file asking for source data file SF Mailmerge 1 February 24th 06 04:51 AM
How can I merge data into a form from the keyboard vs data file? samxtc Mailmerge 1 December 12th 05 04:43 PM
Merging Label Form File with Data File Becky N Mailmerge 7 February 18th 05 05:47 PM


All times are GMT +1. The time now is 02:11 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"