Hello Everyone,
Great to be able to finally post to this much used resource.
The issue at hand, I receive PowerPoint files with several embedded Excel charts, with no access to the source data. My task is to extract data from specific charts and compile it into a comparative Excel table. While I am able to get the series data points and compiling the data after retrieval is not an issue, my challenge has been to get the horizontal axis data point labels.
Sample Chart
Garbled image removed by Moderator
Sample Code
Sub test()
Dim sld As Slide
Dim shp As Shape
Dim valarray As Variant
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasChart Then
If shp.Chart.ChartType = 51 And InStr(LCase(shp.Chart.ChartTitle.Text), "mom") > 0 Then
Debug.Print sld.SlideNumber
Debug.Print shp.Chart.ChartTitle.Text & ": " & shp.Chart.ChartType
valarray = shp.Chart.SeriesCollection(2).Values
Debug.Print shp.Chart.SeriesCollection(2).Name
For i = 1 To UBound(valarray)
Debug.Print Round(valarray(i), 4)
Next i
End If
End If
Next shp
Debug.Print
Next sld
End Sub
The code does return the expected chart title and the second series (November) title and values. I have tried various iterations of Chart.SeriesCollection and Chart.Axes code as collections, but not been able to pull the location labels.
Any assistance would be appreciate.
Great to be able to finally post to this much used resource.
The issue at hand, I receive PowerPoint files with several embedded Excel charts, with no access to the source data. My task is to extract data from specific charts and compile it into a comparative Excel table. While I am able to get the series data points and compiling the data after retrieval is not an issue, my challenge has been to get the horizontal axis data point labels.
Sample Chart
Garbled image removed by Moderator
Sample Code
Sub test()
Dim sld As Slide
Dim shp As Shape
Dim valarray As Variant
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasChart Then
If shp.Chart.ChartType = 51 And InStr(LCase(shp.Chart.ChartTitle.Text), "mom") > 0 Then
Debug.Print sld.SlideNumber
Debug.Print shp.Chart.ChartTitle.Text & ": " & shp.Chart.ChartType
valarray = shp.Chart.SeriesCollection(2).Values
Debug.Print shp.Chart.SeriesCollection(2).Name
For i = 1 To UBound(valarray)
Debug.Print Round(valarray(i), 4)
Next i
End If
End If
Next shp
Debug.Print
Next sld
End Sub
The code does return the expected chart title and the second series (November) title and values. I have tried various iterations of Chart.SeriesCollection and Chart.Axes code as collections, but not been able to pull the location labels.
Any assistance would be appreciate.
Last edited by a moderator: