How to prevent showing default graph

T

TFM

Hi,

I'm trying to make Chart as OLE Object using MSGraph.Chart.8 in
PowerPoint, and I am using VB.Net as programming language. The problem
is that as soon as my code reaches the line oShapes.AddOLEObject(150,
150, 480, 320, "MSGraph.Chart.8") it displays a 3D multibar gragh on
the slide which is probably the default graph. Whereas I want to change
the type of the graph and give my own data to show on the slide. I'm
able to change the type and data of the graph. When I ask my
application to add graph to a slide in the running slide show It first
displays the default graph with default values and then the graph which
I want after some pause. I want to somehow prevent displaying default
graph and only display the graph after I change it's type and set the
data values I want to show on the graph.

Here is the code I'm using to make graph:
Dim oSlide As PowerPoint.Slide
Dim oChart As Graph.Chart
Dim oShapes As PowerPoint.Shapes
Dim oShape As PowerPoint.Shape
Dim oOLEFormat As PowerPoint.OLEFormat

oSlide = oSlideShow.Slide
oShapes = oSlide.Shapes
oShape = oShapes.AddOLEObject(150, 150, 480, 320,
"MSGraph.Chart.8")
oOLEFormat = oShape.OLEFormat
oChart = oOLEFormat.Object

oChart.ChartType = Graph.XlChartType.xlColumnClustered

oChart.Application.DataSheet.Cells.Clear()
oChart.HasLegend = False

oChart.Application.DataSheet.Range("A0").Value = "Option 1"
oChart.Application.DataSheet.Range("B0").Value = "Option 2"
oChart.Application.DataSheet.Range("C0").Value = "Option 3"

oChart.Application.DataSheet.Range("A1").Value = 10
oChart.Application.DataSheet.Range("B1").Value = 20
oChart.Application.DataSheet.Range("C1").Value = 30

'Nothing to release references.
oChart = Nothing
oOLEFormat = Nothing
oShape = Nothing
oShapes = Nothing
oSlide = Nothing

How should I modify this code to achieve above stated objective.
 
C

Cindy M.

Hi Tfm,
I'm trying to make Chart as OLE Object using MSGraph.Chart.8 in
PowerPoint, and I am using VB.Net as programming language. The problem
is that as soon as my code reaches the line oShapes.AddOLEObject(150,
150, 480, 320, "MSGraph.Chart.8") it displays a 3D multibar gragh on
the slide which is probably the default graph. Whereas I want to change
the type of the graph and give my own data to show on the slide. I'm
able to change the type and data of the graph.
Since no one else has ventured a reply...

1. I don't think it's possible to make MS Graph default to showing no
chart, or a different kind of chart. I think this is built into the way
MS Graph initializes when a new object is created. MS Graph has many,
many drawbacks, especially when you need to automate it. Many therefore
use an Excel chart, instead.

2. The best place to ask questions concerning Powerpoint is the
powerpoint newsgroup.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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 :)
 
T

TFM

Can you use Excel Charts in power point ?
Cindy said:
Hi Tfm,

Since no one else has ventured a reply...

1. I don't think it's possible to make MS Graph default to showing no
chart, or a different kind of chart. I think this is built into the way
MS Graph initializes when a new object is created. MS Graph has many,
many drawbacks, especially when you need to automate it. Many therefore
use an Excel chart, instead.

2. The best place to ask questions concerning Powerpoint is the
powerpoint newsgroup.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)


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