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.
Regards,
Zeeshan.
Cindy M. - 24 Dec 2006 17:28 GMT
Hi Zm,
> I'm trying to make Chart as OLE Object using MSGraph.Chart.8 in
> PowerPoint, and I am using VB.Net as programming language.
Then this is not the appropriate group to ask your question. VSTO
does not equal "questions about Office application". VSTO is a
special technology.
The best place to ask this would be the powerpoint newsgroup.
Next best the office.developer.automation newsgroup. But your
chances of getting help are better in the PowerPoint newsgroup.
Be sure to mention which version of Office you're working with
when you ask.
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 :-)