#1
|
|||
|
|||
Word mail merge with unique charts
Hi there,
I'm trying to create a mail merge where each document contains a bar graph based off a value, seems a really simple task but I don't think its achievable. I did find one helpful post (https://www.msofficeforums.com/mail-...cel-graph.html) where user macropod briefly explained to use field codes, the demo works but information is lacking online. I currently generate these letters using a PHP script outputing them as PDF files but it would make life so much easier if i could convert this as a mail merge, the only thing stopping me is the chart. My current chart setup is based on "Name" "Number of Minutes Lost" Some students have values of 15 minutes lost, 189 minutes lost all the way up to 3989 minutes lost The green bar is average for the year Any advice would be greatly apreciated! Last edited by retro; 03-13-2019 at 03:05 AM. Reason: image example upload |
#2
|
||||
|
||||
Did you try implementing the example in the Demo document in the link?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for the reply,
I did and it works great, struggled with implementing it to fit the 21 conditions i have though, edited your example to accommodate numbers above 100 (as im not dealing with percentages) but this can be unmanageable when dealing with numbers that run into the thousands, which is why i need some if statements eg if val < 10 then only draw graph up to the less than 10 mark, if val > 200 then draw the full chart |
#4
|
||||
|
||||
For the most part, all you should need to do is copy & paste the example from that document as-is, rather than trying to reconstruct the entire field yourself.
As for the output, maybe you should consider using logarithmic values for the output. That way the re-scaling is both progressive and automatic. To see how to do that in Word, check out the Logarithms topic in my Microsoft Word Field Maths Tutorial: https://www.msofficeforums.com/word/...-tutorial.html. Otherwise, all you need to add is a single IF test that divides the merged value by a given constant if it exceeds 10.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
Maybe https://www.gmayor.com/mail_merge_charts.htm would help?
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#6
|
|||
|
|||
Thankyou for the reply ...
I have managed to do it another way as i needed it to look as close to the chart as possible, I have now amended my mail merge data with a new column and a nested if statement in excel puts the file paths in matching the conditions i have set, I then used macropod's example of field code to include a picture in the word mail merge. { include picture {if true"{MERGEFILED pupil_mins_lost_imagepath}" \d } This works as intended! Thankyou both for your help |
#7
|
|||
|
|||
Retro,
were you able to figure out this mail merge? I have the similar issue with students that I am trying to mail merge letters with a chart for each student. |
#8
|
|||
|
|||
I did....
It was hard work though, how far have you got with your mail merge fields? if you press alt+F9 you will see the merge field code i then added my merge field source spreadsheet with filepaths to my images needed and used this { include picture {if true"{MERGEFILED pupil_mins_lost_imagepath}" \d } press alt+F9 and preview the results and your image should appear if it exists in the image path in your mail merge source |
#9
|
||||
|
||||
The Demo document attached to https://www.msofficeforums.com/73816-post2.html shows how to implement a simple bar chart. All you'd need to do is to copy the field coding into your own document and change the mergefield's source name to suit your data. As presented, the coding charts percentages up to 100. They don't have to be percentages, though, and the logic is easily extended to include hundreds and thousands but, once you start getting into that, a logarithmic scale might be more useful.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
charts, mail merge |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge List of Items for Unique OwnerIDs | HunterH | Mail Merge | 1 | 10-12-2018 02:03 PM |
Unique data per record in mail merge chart | aplarsen | Word VBA | 2 | 02-16-2018 04:01 PM |
Activating Unique Links in Email Messages Using a Mail Merge | User02182016 | Mail Merge | 1 | 02-23-2016 06:02 PM |
Mail Merge URL - a unique question | kitefrantic | Mail Merge | 1 | 12-31-2013 07:34 PM |
dynamic charts based on mail merge fields | jwajehee | Mail Merge | 0 | 10-05-2011 09:47 AM |