HasAutoCaption Property Example

This example sets the caption for the specified trendline caption if the caption is currently set to be generated automatically. Note that SeriesCollection(0) must refer to a series that already has a trendline.

Set sZero = ChartSpace1.Charts(0).SeriesCollection(0)
sZero.Line.Color = "red"
Set trndline = sZero.Trendlines(0)
If trndline.HasAutoCaption Then trndline.Caption = "data trend"