Z
ZM
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. I'm using
MSOffice XP.
Regards,
Zeeshan.
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. I'm using
MSOffice XP.
Regards,
Zeeshan.