Hi
calling the selections and returning the value to the macro is beyond my VBA skills I'm afraid.
But this modification of the macro above achieves a similar result - listing all the chart shapes on the slide, allowing the user to select one then extracting the values from it.
Sub copy_series_values_to_clipboard()
Dim ss As Variant, n As Long, txt As String, se, sh As Shape, ChartList As String, res
Dim mydata As DataObject
Set mydata = New DataObject
txt = "X Values" & Chr(13)
ChartList = ""
res = ""
For Each sh In ActiveWindow.Selection.SlideRange.Shapes
If sh.Type = 3 Then
ChartList = ChartList & Chr(13) & sh.Id & " " & sh.Name
If res = "" Then res = sh.Name
End If
Next sh
If ChartList = "" Then
MsgBox "no chart found"
End
End If
res = InputBox("enter the name of the shape to extract data from" & Chr(13) & Chr(13) & ChartList, "enter number", res)
chartshape = res
ss = ActiveWindow.Selection.SlideRange.Shapes(chartshape).Chart.SeriesCollection(1).XValues
For n = 1 To ActiveWindow.Selection.SlideRange.Shapes(chartshape).Chart.SeriesCollection(1).Points.Count
txt = txt & ss(n) & Chr(13)
Next n
For Each se In ActiveWindow.Selection.SlideRange.Shapes(chartshape).Chart.SeriesCollection
txt = txt & Chr(13) & se.Name & Chr(13)
ss = se.Values
For n = 1 To se.Points.Count
txt = txt & ss(n) & Chr(13)
Next n
Next se
mydata.SetText txt
mydata.PutInClipboard
MsgBox "Copied to clipboard:" & Chr(13) & txt
mydata.Clear
End Sub
Bookmarks