Charts in a mail merge

L

Lisa@Pru

I have a mail merge document that started out using Excel as it's merge file
but now that I have over 1000 merge fields, I have to save the Excel file as
a csv file, then open and save that in Word so I can perform the merge.

My merge document needs to contain a pie chart that will be specific to each
record in the merge. It needs to refresh itself with new data each time the
merge grabs a new record.

Can this be done, and if so, can you please tell me how?

Thanks,

Lisa
 
L

Lisa@Pru

Peter,

I have looked at this link as it is mentioned on many forums. I have no
idea what it's telling me or how to make this work. I printed out some text
associated with this link and here's where I get lost:

Note that the chart and bookmark can be in a table cell or a frame if you
want to have text flow around the chart.
 Insert a normal module and a class module into the main merge document's
project and copy in the corresponding code.
 Go into Tools/References in the Visual Basic Editor and activate the
checkbox next to Microsoft Office Graph 10.0 Object Library. (Or 11.0 if you
have Office 2003)
 Run the procedure MergeWithChart in order to execute the merge to a new
document.

I have no idea how to do the above - any suggestions?

Thanks again!!!!
 
D

Doug Robbins - Word MVP

Start by reading the information in the article "What do I do with macros
sent to me by other newsgroup readers to help me out?†at:

http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

If that is not enough to get you started, send me an email so that I have
your email address and I will put together an illustrated description of
what it is telling you to do.
--
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, originally posted via msnews.microsoft.com
 
P

Peter Jamieson

AFAICS the information in "How to use MergeWithAChart.doc" is really about
how to produce your own merge starting from the example files. It's not a
set of instructions for running the merge in MailMergePieChartLetter.doc. I
think if you can run the example, other things may become more clear.

However, no data source for the merge is provided with the example files.
The data source is either the Employees table in the old Access
"Northwind.mdb" database or a derivative of it (I don't think the basic
table has the "Sales" field that's used in the merge is in that table, and
some of the merge field names have underscores whereas the Northwind table
have either spaces or nothing. You may find the following data works if you
copy it into a .txt file (I haven't checked!)

EmployeeID,Last_Name,First_Name,Title_Of_Courtesy,Address,City,Region,Postal_Code,Country,Total_Sales
1,Davolio,Nancy,Ms.,507 - 20th Ave. E. Apt. 2A,Seattle,WA,98122,USA,55014
2,Fuller,Andrew,Dr.,908 W. Capital Way,Tacoma,WA,98401,USA,70665
3,Leverling,Janet,Ms.,722 Moss Bay Blvd.,Kirkland,WA,98033,USA,76383
4,Peacock,Margaret,Mrs.,4110 Old Redmond Rd.,Redmond,WA,98052,USA,52422
5,Buchanan,Steven,Mr.,14 Garrett Hill,London,,SW1 8JR,UK,15695
6,Suyama,Michael,Mr.,10 Miner Rd.,London,,EC2 7JR,UK,10147
7,King,Robert,Mr.,33 Winchester Way,London,,RG1 9SP,UK,50548
8,Callahan,Laura,Ms.,4726 - 11th Ave. N.E.,Seattle,WA,98105,USA,49022
9,Dodsworth,Anne,Ms.,7 Houndstooth Rd.,London,,WG2 7LT,UK,35181

When you have connected the data source, open up the VBA Editor and look at
the project for this document. There should be a "Modules" item and a "Class
Modules" item under the project. If you open up the Modules item you should
see basMergeWithChart. This contains a Sub called MergeWithChart that you
should be able to run from within the VBA Editor to perform the merge.
The "Event handling" part of the code is in the Class Module called
clsMergeEvents

So what Cindy is saying here...
Note that the chart and bookmark can be in a table cell or a frame if you
want to have text flow around the chart.
 Insert a normal module and a class module into the main merge document's
project and copy in the corresponding code.

....is "if you want to make your own similar application starting from your
own mailmegre main document, copy those two modules into your own
mailmerge's main document". But it will probably be easier tjust to start
from Cindy's sample application, partly because...
 Go into Tools/References in the Visual Basic Editor and activate the
checkbox next to Microsoft Office Graph 10.0 Object Library. (Or 11.0 if
you
have Office 2003)

....this reference should already be set.

If you're not that familiar with VBA, some of that will probably be
incoprehensible, but if you can step through what I have said and let us
know where you get stuck, I think progress is possible.

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top