Hey all,
I have an Excel export to PPT function that works well except that it only creates one series in the PPT graph. Although the data for the second series is copied into the PPT Graph Input Sheet, the graph does not add a series for this data. E.g., Col.A. is all the X-Series labels, Col.B. is Series 1, Col.C. is Series 2. The following code tries to add the series then format it appropriately; the formatting section works ok. The error code I receive is Method 'Extend' of object 'SeriesCollection' Failed. The directory mentioned to retrieve the chart template files has been altered.
Sub UpdateGraphs()
Dim sld As Slide
Dim sh As Shape
Dim ch As Chart
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
If sh.HasChart Then
Set ch = sh.Chart
If ch.Name = "Chart1" Then
'ch.ApplyChartTemplate ("Templates\Chart1.crtx")
ch.SeriesCollection.Extend "='Sheet1'!$C$1:$C$41"
End If
If ch.Name = "Chart2" Then
ch.ApplyChartTemplate ("Templates\Chart2.crtx")
End If
If ch.Name = "Chart3" Then
ch.ApplyChartTemplate ("Templates\Chart3.crtx")
End If
End If
Next
Next
End Sub
Bookmarks