If you run the code below - it generates a chart - if you then click on one of the datapoints on the chart - you get MS Excel message - text too long - If I only chart 1000 datapoints - I get now error - but with 2K I do - any idea?
Code:
Public Sub AddChartX1()
Dim NumCharts As Long
Dim PlotCounter As Long
Dim DataPtsInChart As Long
Dim TempValues() As Single
DataPtsInChart = 2000
ReDim TempValues(1 To DataPtsInChart)
For i = 1 To DataPtsInChart
TempValues(i) = i
Next i
ActiveSheet.ChartObjects.Add Left:=100, Top:=50, Width:=800, Height:=300
NumCharts = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(NumCharts).Activate
PlotCounter = 0
Dim Achart As ChartObject
Set Achart = ActiveSheet.ChartObjects(NumCharts)
With Achart.Chart
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
PlotCounter = PlotCounter + 1
.Axes(xlCategory).TickMarkSpacing = UBound(TempValues) / 60
.Axes(xlCategory).TickLabelSpacing = UBound(TempValues) / 60
.SeriesCollection(PlotCounter).Values = Array(TempValues)
.SeriesCollection(PlotCounter).Border.LineStyle = xlHairline
.SeriesCollection(PlotCounter).MarkerStyle = xlMarkerStyleNone
.HasLegend = False
End With
Set Achart = Nothing
End Sub