Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Sonja Sonja is offline
external usenet poster
 
Posts: 7
Default Merging one line out of multiple lines

I have copied merged an address field that is all one field. There is a
total of three lines in this field , customer name is on the first line,
address on 2nd line and so on. I would like to take line one the customer
name and place it into another field. Example:
Dear (customer name from first line of address field)

Can you tell me if this is possible?

Thanks in advance for your help!
  #2   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 Merging one line out of multiple lines

It is not that easy to do after the merge. I would manipulate the data
source. If it is a table in a Word Document, Insert a new column after the
last column and then use the following macro

Dim i As Long
Dim company As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set company = .Cell(i, 1).Range
company.Collapse wdCollapseStart
company.Select
.Cell(i, .Columns.Count).Range.Text =
Selection.Bookmarks("\line").Range.Text
Next i
End With

This assumes that the address is in the first field. If it is not, change
the 1 in the line

Set company = .Cell(i, 1).Range

to the number of the column that contains the address.

If your data source is not a table in a Word document, use a catalog or
directory type mail merge to create a table that contains the data, then
insert a row at the top of the table into which you enter the names of the
merge fields and then add the column and run the above macro.
--
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

"Sonja" wrote in message
...
I have copied merged an address field that is all one field. There is a
total of three lines in this field , customer name is on the first line,
address on 2nd line and so on. I would like to take line one the customer
name and place it into another field. Example:
Dear (customer name from first line of address field)

Can you tell me if this is possible?

Thanks in advance for your help!



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Sonja Sonja is offline
external usenet poster
 
Posts: 7
Default Merging one line out of multiple lines

Thank you Doug

My data source is from Access database. The information is copied into
Access and then merged into my mailmerge document.

"Doug Robbins - Word MVP" wrote:

It is not that easy to do after the merge. I would manipulate the data
source. If it is a table in a Word Document, Insert a new column after the
last column and then use the following macro

Dim i As Long
Dim company As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set company = .Cell(i, 1).Range
company.Collapse wdCollapseStart
company.Select
.Cell(i, .Columns.Count).Range.Text =
Selection.Bookmarks("\line").Range.Text
Next i
End With

This assumes that the address is in the first field. If it is not, change
the 1 in the line

Set company = .Cell(i, 1).Range

to the number of the column that contains the address.

If your data source is not a table in a Word document, use a catalog or
directory type mail merge to create a table that contains the data, then
insert a row at the top of the table into which you enter the names of the
merge fields and then add the column and run the above macro.
--
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

"Sonja" wrote in message
...
I have copied merged an address field that is all one field. There is a
total of three lines in this field , customer name is on the first line,
address on 2nd line and so on. I would like to take line one the customer
name and place it into another field. Example:
Dear (customer name from first line of address field)

Can you tell me if this is possible?

Thanks in advance for your help!




  #4   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 Merging one line out of multiple lines

Unless using the original source is simpler. Open the table in Access and
select all of the records by clicking in the top left corner adjacent to the
first field name and then copy and paste into a Word document, and then add
one more column and run the macro that I gave you.

--
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

"Sonja" wrote in message
...
Thank you Doug

My data source is from Access database. The information is copied into
Access and then merged into my mailmerge document.

"Doug Robbins - Word MVP" wrote:

It is not that easy to do after the merge. I would manipulate the data
source. If it is a table in a Word Document, Insert a new column after
the
last column and then use the following macro

Dim i As Long
Dim company As Range
With ActiveDocument.Tables(1)
For i = 2 To .Rows.Count
Set company = .Cell(i, 1).Range
company.Collapse wdCollapseStart
company.Select
.Cell(i, .Columns.Count).Range.Text =
Selection.Bookmarks("\line").Range.Text
Next i
End With

This assumes that the address is in the first field. If it is not,
change
the 1 in the line

Set company = .Cell(i, 1).Range

to the number of the column that contains the address.

If your data source is not a table in a Word document, use a catalog or
directory type mail merge to create a table that contains the data, then
insert a row at the top of the table into which you enter the names of
the
merge fields and then add the column and run the above macro.
--
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

"Sonja" wrote in message
...
I have copied merged an address field that is all one field. There is a
total of three lines in this field , customer name is on the first
line,
address on 2nd line and so on. I would like to take line one the
customer
name and place it into another field. Example:
Dear (customer name from first line of address field)

Can you tell me if this is possible?

Thanks in advance for your help!






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
Merging multiple lines jewell Mailmerge 3 December 21st 06 10:45 PM
numbering a document line-by-line SKIPPING blank lines... Number nutso Page Layout 2 October 26th 06 11:27 PM
Merging 1500 lines, stops at 712 lines why Edmonds Mailmerge 1 July 19th 06 04:38 AM
HELP! Mailmerge only merging even numbered lines from spreadsheet. MichelleRL Mailmerge 3 March 22nd 06 08:23 PM
How do keep blank lines when merging a document with the data and. ftroop Mailmerge 1 March 30th 05 04:27 PM


All times are GMT +1. The time now is 10:06 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"