Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2014, 08:07 PM
natasha_arriell natasha_arriell is offline Inserting table Windows 7 64bit Inserting table Office 2013
Novice
Inserting table
 
Join Date: Jun 2014
Posts: 4
natasha_arriell is on a distinguished road
Default Inserting table

Hi guys,

I'm a beginner with using mail merge.
I want to start mail merge data from Excel to MS word. I have to create or produce a letter for each record/ name. On top of that I need to create or insert a table format for each record/name. I have been searching for ages already and come across different tutorials from gmayorlinks,msoffice tutorials but couldn't fully grasp it. Hard for me to understand. Does anyone have a simple explanation or simple code i could follow? Also, anyone knows how to insert tables when doing mail merge but the rows are not fixed. It will depend on how many brother's the client has.

Need Advice please.
Much appreciated!

Example

in Excel format

first name Surname brother 1 age1 brother 2 age2 brother 3 age3
Jane Smith Sarah 18 Carlo 25 Christ in 28
Alex Curtis Cameron 37
Ben Arandt Tim 40 Simon 45

OUTPUT in Word

Client Name: Jane Smith

Brother's name | brother's Age
Sarah 18


carlo 25
Christin 28


* new page or new latter

Client Name: Alex Curtis

Brother's name | brother's Age
cameron 37
Reply With Quote
  #2  
Old 06-03-2014, 06:17 PM
macropod's Avatar
macropod macropod is offline Inserting table Windows 7 32bit Inserting table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your description suggests all you need is an ordinary letter merge, with a mergefield for each field in your data source, along the lines of:

Client Name: «Given_Name»«Family_Name»
Brother's name | Brother's Age
«Brother1» | «Age1»
«Brother2» | «Age2»
«Brother3» | «Age3»

where the words between the chevrons are your field names.

Note: You can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-03-2014, 10:28 PM
natasha_arriell natasha_arriell is offline Inserting table Windows 7 64bit Inserting table Office 2013
Novice
Inserting table
 
Join Date: Jun 2014
Posts: 4
natasha_arriell is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Your description suggests all you need is an ordinary letter merge, with a mergefield for each field in your data source, along the lines of:

Client Name: «Given_Name»«Family_Name»
Brother's name | Brother's Age
«Brother1» | «Age1»
«Brother2» | «Age2»
«Brother3» | «Age3»

where the words between the chevrons are your field names.

Note: You can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
Hi Paul,

Thanks for the reply. I actually wanted the records to be inserted in a table. And each CLIENT will have its own page or letter. With the above example the problem im encountering is that if some clients has only one brother and the others has many. Then there will be rows that are are empty. Which I don't want to be shown. Rows will depend on how many brothers the client has.


I was following some of your examples from other threads and have managed to kind of put the data inside the table but it's creating a space between each row.

I also did a brute force if else statement for every client. But it's not really ideal. Will only be ok for few records.




Thanks Paul
Reply With Quote
  #4  
Old 06-03-2014, 10:40 PM
natasha_arriell natasha_arriell is offline Inserting table Windows 7 64bit Inserting table Office 2013
Novice
Inserting table
 
Join Date: Jun 2014
Posts: 4
natasha_arriell is on a distinguished road
Default

Hi paul,

I forgot to attached the screenshot for reference. Both codes resulted in a not quite right output that I want.

Any help will be greatly appreciated.

Thanks
Attached Images
File Type: png sample3.PNG (13.3 KB, 23 views)
File Type: png ifelse.PNG (14.6 KB, 22 views)
Reply With Quote
  #5  
Old 06-04-2014, 12:13 AM
macropod's Avatar
macropod macropod is offline Inserting table Windows 7 32bit Inserting table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Instead of that approach, what you need is something along the lines of:

Client Name: «Given_Name»«Family_Name»
{IF«Brother1» <> "" "Brother's name | Brother's Age
|«Brother1» | «Age1»|"}
{IF«Brother2» <> "" "|«Brother2» | «Age2»|"}
{IF«Brother3» <> "" "|«Brother3» | «Age3»|"}

where:
{IF«Brother1» <> "" "Brother's name | Brother's Age
|«Brother1» | «Age1»|"}
represents both the heading row and the first data row, followed by separate 1-row tables for each of:
{IF«Brother2» <> "" "|«Brother2» | «Age2»|"}
and
{IF«Brother3» <> "" "|«Brother3» | «Age3»|"}
and so on, up to the maximum number of rows needed. This will leave an empty paragraph between each row, but formatting can be used to minimise its appearance.

The alternative is to use as many separate complete tables as you need, embedded in nested fields like:

Client Name: «Given_Name»«Family_Name»
{IF«Brother3» <> "" "Brother's name | Brother's Age
|«Brother1» | «Age1»|
|«Brother2» | «Age2»|
|«Brother3» | «Age3»|" {IF«Brother2» <> "" "Brother's name | Brother's Age
|«Brother1» | «Age1»|
|«Brother2» | «Age2»|" {IF«Brother1» <> "" "Brother's name | Brother's Age
|«Brother1» | «Age1»|"}}}
In this case, there are three embedded tables.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting table Inserting Images/Pictures into Table of Content Simon Word 11 09-12-2016 11:37 PM
Inserting table Inserting landscape Table into Portrait Document sstark Word Tables 2 02-13-2013 08:43 AM
Inserting table Inserting a date calculated from a table cell theMikeD Word 2 09-11-2012 05:46 PM
Inserting a table Katelyn Outlook 0 04-05-2012 09:39 AM
inserting a string of data into an MS Word table??? matto Word VBA 0 07-16-2010 09:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft