Hey guys i need some help on excel chart

hello all

The code below just creates a doc file which puts a excel chart on the doc file but the probelm is how do i change the chart type and give data for the chart to plot

Dim letters As New Word.Application
Dim letterdoc As New Word.Document
Set letterdoc = letters.Documents.Add
With letters
    .Selection.TypeText "Total closed tickets by priority"
    .Selection.InlineShapes.AddOLEObject ClassType:="excel.chart.8"
    End With

letterdoc.SaveAs "c:\kalpesh1.doc"
Set letterdoc = Nothing
Set letters = Nothing

this is what i wanna do but how do i do it???

i tried to use record the macro but somehow it wont work

plz help me!!

Who is Participating?
q2eddieConnect With a Mentor Commented:
Hi, kaldude.

1. "HOWTO: Automate An Embedded MSGraph Object with Visual Basic"

Bye. -e2
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

kaldudeAuthor Commented:
Hey man

thanx a bunch for that prompt reply

dude i know how to make excel component work but dude my problem is little diff from what we have in that prog

i want to put an excel chart on the word doc as ya can do it from word and then change the data and all that, so i wanna do same thing from vb make a doc file fill in all the data and then create a excel chart with some other data!!

thanx dude
kaldudeAuthor Commented:
coz i'm using bookmarks in word to replace data so cant go with just excel.


For that example:
Change the following line ...
Dim oGraphChart As Graph.Chart

to this ...
Dim oGraphChart As Variant

Bye. -e2
kaldudeAuthor Commented:
Ya d-man

thanx a million!!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.