This event is generated whenever the user selects the ExportData toolbar button (see Toolbar).  Use this event to perform operations specific to whenever the ExportData toolbar button is selected.



'XYChartCtl1 is the name of the XY Chart control instance placed on the form

Private Sub XYChartCtl1_ExportDataButtonSelected()               

    XYChartCtl1.OverrideExportDataButton = True 'Do not execute XYChart's internal ExportData method

    ' Copy ChartData array to Clipboard (Tab de-limited)

    Dim Row As Integer, Col As Integer
Dim LineString As String, EntireArrayString As String
    Dim ChartData As Variant

    ChartData = XYChartCtl1.ChartData

    For Row = 1 To UBound(ChartData)
        LineString = ""
        For Col = 1 To XYChartCtl1.NumProfiles * 2
            If Col = 1 Then
                LineString = CStr(ChartData(Row, Col))
                LineString = LineString + CStr(vbTab) + CStr(ChartData(Row, Col))
            End If
        Next Col
        EntireArrayString = EntireArrayString + vbCrLf + LineString
    Next Row

    Clipboard.SetText EntireArrayString 'Copy all to Clipboard


End Sub                                        


See Also

Events    OverrideExportDataButton