Class Trendline (Word VBA)

The class Trendline represents a trendline in a chart.

To use a Trendline class variable it first needs to be instantiated, for example

Dim trnln as Trendline
Set trnln = ActiveDocument.Background.Chart.FullSeriesCollection(1).Trendlines(Index:=1)

The following procedures can be used to set variables of type Trendline: Trendlines.Add and Trendlines.Item.

For Each

Here is an example of processing the Trendline items in a collection.

Dim trnln As Trendline
For Each trnln In ActiveDocument.Background.Chart.FullSeriesCollection(1).Trendlines()
	
Next trnln

Methods

ClearFormats - Clears the formatting of the object.

Delete - Deletes the object.

Select - Selects the object.

Properties

Backward2 returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward.

Border returns the border of the object.

DataLabel returns the data label that is associated with the trendline.

DisplayEquation true if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value).

DisplayRSquared true if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation).

Format returns the line, fill, and effect formatting for the object.

Forward2 returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward.

Index returns the index number of the object within the collection of similar objects.

Intercept returns or sets the point where the trendline crosses the value axis.

InterceptIsAuto true if the point where the trendline crosses the value axis is automatically determined by the regression.

Name returns or sets name of the object.

NameIsAuto true if Microsoft Word automatically determines the name of the trendline.

Order returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial.

Period returns or sets the period for the moving-average trendline.

Type returns or sets the trendline type.

ChartBorder - Represents the border of an object.

ChartFormat - Provides access to the OfficeArt formatting for chart elements.

DataLabel - Represents the data label on a chart point or trendline.