How do i create and modify a chart in a Word doc from VBA?

M

Mr. T.

Hello,

i've got a word-document with tables in it. Now i want to generate charts
automatically based upon the data in these tables.

I've been looking around, but haven't really found any documentation or
examples that were helpful to me.

These are the questions:
* how to create a chart in VBA?
* how to get it to base it's data upon a table in my word document?
* how to change the type of chart (to bars, pie, ...)

Any help would be greatly appreciated!

Thx in advance,

Thomas
 
C

Cindy M -WordMVP-

Hi Mr.,
i've got a word-document with tables in it. Now i want to generate charts
automatically based upon the data in these tables.

I've been looking around, but haven't really found any documentation or
examples that were helpful to me.

These are the questions:
* how to create a chart in VBA?
* how to get it to base it's data upon a table in my word document?
* how to change the type of chart (to bars, pie, ...)
The first question you have to answer for yourself is: do you want MS Graph
charts or Excel charts?

The advantages of MS Graph charts:
- the user wouldn't have to have Excel installed to use them
- the leave a smaller "footprint" in the document
- you can link them to a Word table in the same doc
- it's more stable to automate, IF you do it right

The disadvantages are:
- the interface isn't as "powerful" as Excel's
- you don't have a color palette

Just to get you going, you'll find a sample document with macro on my
website, in the Mail merges FAQ, special section. It's aimed at letting a
user produce an MS Graph for every record in a mail merge (2002/2003), but
you can get the very basics of automating MS Graph.

The charting part of MS Graph's object model is essentially the same as
Excel's. Same commands, everything.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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