Programatically (C#) applying data to multiple axis Graph in PPT

R

Racter

I have created an application that pulls data and output the data to a graph
on a PPT slide. I have ran into an issue trying to plot data on more than one
axis. Can anyone shed some light on this for me?

Thanks,

Racter
 
R

Racter

Problem is I am unable to identify the interface to the graph that allows me
to state what data in the datasheet goes on which axis. If I manually edit
the graph in Powerpoint I can then change the axis. I nned to automate this.
Documentation for the graph component is not much help.

Thanks.
 
S

Shyam Pillai

Racter,

Sub TestCode()
Call MoveSeriesToSecondaryAxes(ActiveWindow.Selection.ShapeRange(1), 2)
End Sub

Sub MoveSeriesToSecondaryAxes(oChartShape As Shape, SeriesIndex As Integer)

Dim oChart As Object 'Chart

' Get the reference to the Chart object.
Set oChart = oChartShape.OLEFormat.Object
' Move specified series to secondary axis, works with 2D charts only,
' add necessary error checks
oChart.SeriesCollection(SeriesIndex).AxisGroup = 2

' Update the graph and quit the graph application
oChart.Application.Update
oChart.Application.Quit
Set oChart = Nothing

End Sub


--
Regards
Shyam Pillai

Toolbox: http://www.mvps.org/skp/toolbox/
 

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