Hello, I am trying to build a code that pulls data from an access database and fills charts in a powerpoint file with a template. This template has two charts initially built in 97-2003 format but i'm trying to update them to office 2013 charts.
I am running a macro that finds all the shapes available in the slide. The problem here is that the loop find everything (titles, footpages, excel 2003 shapes) but can't find the 2013 chart that I inserted in the template. Here is the code I have:
Private Function GetChartObject(ByVal sl As powerpoint.Slide, ByVal ChartIndex As Integer) As graph.Chart
Dim strChartName As String
Dim sh As powerpoint.Shape
Dim ch As graph.Chart
strChartName = "Chart" & Trim(CStr(ChartIndex))
For Each sh In sl.Shapes
If sh.AlternativeText = strChartName Then
Set ch = sh.OLEFormat.Object
Exit For
End If
Next sh
Set GetChartObject = ch
End Function
----------------------------------------------------------------------
If someone can help me finding out why the 2013 graph is not detected by the loop would great!
Thanks in advance!
I am running a macro that finds all the shapes available in the slide. The problem here is that the loop find everything (titles, footpages, excel 2003 shapes) but can't find the 2013 chart that I inserted in the template. Here is the code I have:
Private Function GetChartObject(ByVal sl As powerpoint.Slide, ByVal ChartIndex As Integer) As graph.Chart
Dim strChartName As String
Dim sh As powerpoint.Shape
Dim ch As graph.Chart
strChartName = "Chart" & Trim(CStr(ChartIndex))
For Each sh In sl.Shapes
If sh.AlternativeText = strChartName Then
Set ch = sh.OLEFormat.Object
Exit For
End If
Next sh
Set GetChartObject = ch
End Function
----------------------------------------------------------------------
If someone can help me finding out why the 2013 graph is not detected by the loop would great!
Thanks in advance!