Formatting Graphs with VBA in powerpoint

C

carlleese24

Hi all

I wonder if someone can help me I have 130 slides in a presentation and
I need to format the first series in each graphs in those slides.

The following is what I want to format

..ColorIndex = 7
..Weight = Graph.xlThick
..LineStyle = Graph.xlContinuous

and
..MarkerStyle = xlnone but I cannot seem to get this one to work


I have found this code but it formats all the series in the graph, not
just one series which I want and does not automatically go to the next
slide

For this code to work I have to go on each and every slide and select
the graphs which I do not want to do, this needs to be done
automatically



VBA Code:
--------------------




Sub Test()

Dim oChart As Graph.Chart
Dim oSeries As Graph.Series

' For test purposes, you'll need to add a chart
' to the current slide and select it
Set oChart = ActiveWindow.Selection.ShapeRange(1).OLEFormat.Object

With oChart
For Each oSeries In .SeriesCollection

With oSeries.Border


.ColorIndex = 7
.Weight = Graph.xlThick
.LineStyle = Graph.xlContinuous


'.MarkerStyle =

End With
Next
End With

oChart.Parent.Update
oChart.Parent.Quit
Set oChart = Nothing

End Sub

--------------------





Also if possible I would like to have if statements so depending what
the series name is the colour will change e.g

If the series name is cars then the series colour will be red
If the series name is house then the series colour will be blue

etc


Any help on this would be appreciated


Carl
 

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