AutoCorrect Object

Contains Microsoft Graph AutoCorrect attributes (capitalization of names of days, correction of two initial capital letters, automatic correction list, and so on).

Using the AutoCorrect Object

Use the AutoCorrect property to return the AutoCorrect object. The following example sets Microsoft Graph to correct words that begin with two initial capital letters.

With myChart.Application.AutoCorrect

.TwoInitialCapitals = True

.ReplaceText = True

End With


Axis Object

Represents a single axis in a chart. The Axis object is a member of the Axes collection.

Using the Axis Object

Use Axes(type, group), where type is the axis type and group is the axis group, to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. Group can be either of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

The following example sets the text of the category axis title in the chart.

With myChart.Axes(xlCategory)

    .HasTitle = True

    .AxisTitle.Caption = "1994"

End With


AxisTitle Object

Represents the title of an axis in a chart.

Using the AxisTitle Object

Use the AxisTitle property to return an AxisTitle object. The following example sets the text of the value axis title, sets the font to 10-point Bookman, and formats the word "millions" as italic.

With myChart.Axes(xlValue)

    .HasTitle = True

    With .AxisTitle

        .Caption = "Revenue (millions)"

        .Font.Name = "bookman"

        .Font.Size = 10

        .Characters(10, 8).Font.Italic = True

    End With

End With

Remarks

The AxisTitle object doesn't exist and cannot be used unless the HasTitle property for the specified axis is True.


Border, Font, Interior


Border Object

Represents the border of the specified object.

Using the Border Object

An object's border is treated as a single entity and is always returned as a unit (in its entirety), regardless of how many sides it has. Use the Border property to return the Border object. The following example places a dashed border around the chart area and places a dotted border around the plot area.

With myChart

    .ChartArea.Border.LineStyle = xlDash

    .PlotArea.Border.LineStyle = xlDot

End With


Axis, AxisTitle, ChartArea, ChartTitle, DataLabel, DataLabels, DataTable, DownBars, DropLines, ErrorBars, Floor, Gridlines, HiLoLines, LeaderLines, Legend, LegendKey, PlotArea, Point, Series, SeriesLines, Trendline, UpBars, Walls


Chart Object

Represents the specified Microsoft Graph chart.

Using the Chart Object

Use the Chart property to return a Chart object. Most of the time, you'll create a reference to a Microsoft Graph chart and then use the reference in your code.


Axis, ChartArea, ChartGroups, ChartTitle, Corners, Floor, Legend, PlotArea, SeriesCollection, Walls


ChartGroup Object

Represents one or more series of points plotted in a chart with the same format. A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, which contains all the series plotted with the line chart format, and a bar chart group, which contains all the series plotted with the bar chart format. The ChartGroup object is a member of the ChartGroups collection.

Using the ChartGroup Object

Use ChartGroups(index), where index is the chart group's index number, to return a single ChartGroup object. The following example adds drop lines to chart group one in the chart.

myChart.ChartGroups(1).HasDropLines = True

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named shortcut methods for chart groups to return a particular chart group. The PieGroups method returns the collection of pie chart groups in a chart, the LineGroups method returns the collection of all the line chart groups, and so on. You can use each of these methods with an index number to return a single ChartGroup object, or you can use each one without an index number to return a ChartGroups collection. The following methods are available for chart groups:

•	AreaGroups method

•	BarGroups method

•	ColumnGroups method

•	DoughnutGroups method

•	LineGroups method

•	PieGroups method


DownBars, DropLines, HiLoLines, SeriesCollection, SeriesLines, UpBars


ChartColorFormat Object

Represents a foreground or background color.

Using the ChartColorFormat Object

Use the ForeColor property to return a ChartColorFormat object that represents the foreground fill color. Use the BackColor property to return the background fill color. Use the RGB property to return the color as an explicit red-green-blue value, and use the SchemeColor property to return or set the color as one of the colors in the current color scheme. The following example sets the foreground color, background color, and gradient for the chart area fill in chart one.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


DataLabel Object

Represents the data label for the specified point or trendline in a chart. For a series, the DataLabel object is a member of the DataLabels collection, which contains a DataLabel object for each point. For a series without definable points (such as an area series), the DataLabels collection contains a single DataLabel object.

Using the DataLabel Object

Use DataLabels(index), where index is the data label's index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in the chart.

myChart.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"

Use the DataLabel property to return the DataLabel object for a single point. The following example turns on the data label for the second point in series one in the chart, and sets the data label text to "Saturday."

With myChart

    With .SeriesCollection(1).Points(2)

        .HasDataLabel = True

        .DataLabel.Text = "Saturday"

    End With

End With

For a trendline, the DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text to show only the equation and then places the data label text in cell A1 on the datasheet."

With myChart.SeriesCollection(1).Trendlines(1)

    .DisplayRSquared = False

    .DisplayEquation = True

    x = .DataLabel.Text

End With

With myChart.Application.DataSheet

    .Range("A1").Value = x

End With


DataTable Object

Represents a data table in the specified chart.

Using the DataTable Object

Use the DataTable property to return a DataTable object. The following example adds a data table with an outline border to the embedded chart.

With myChart

.HasDataTable = True

.DataTable.HasBorderOutline = True

End With


ErrorBars Object

Represents the error bars for the specified chart series. Error bars indicate the degree of uncertainty for chart data. Only series in area, bar, column, line, and scatter groups in a 2-D chart can have error bars. Only series in scatter groups can have x and y error bars.

This object isn't a collection. There's no object that represents a single error bar; either you have x error bars or y error bars turned on for all points in a series or you have them turned off.

Using the ErrorBars Object

Use the ErrorBars property to return the ErrorBars object. The following example turns on error bars for series one in embedded chart one and then sets the end style for the error bars.

myChart.SeriesCollection(1).HasErrorBars = True

myChart.SeriesCollection(1).ErrorBars.EndStyle = xlNoCap

Remarks

The ErrorBar method changes the format and type of error bars.


ChartFillFormat Object

Represents fill formatting.

Using the ChartFillFormat Object

Use the Fill property to return the ChartFillFormat object. The following example sets the foreground color, background color, and gradient for the chart area fill in chart one.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


AxisTitle, ChartArea, ChartTitle, DataLabel, DataLabels, DownBars, Floor, Legend, LegendKey, PlotArea, Point, Series, UpBars, Walls


Font Object

Contains the font attributes (font name, font size, color, and so on) for the specified object.

Using the Font Object

Use the Font property to return the Font object. The following example sets the title text for the value axis, sets the font to 10-point Bookman, and formats the word "millions" as italic.

With myChart.Axes(xlValue)

    .HasTitle = True

    With .AxisTitle

        .Caption = "Revenue (millions)"

        .Font.Name = "bookman"

        .Font.Size = 10

        .Characters(10, 8).Font.Italic = True

    End With

End With


AxisTitle, ChartArea, ChartTitle, DataLabel, DataLabels, DataSheet, DataTable, Legend, LegendEntry, TickLabels


Interior Object

Represents the interior of the specified object.

Using the Interior Object

Use the Interior property to return the Interior object. The following example sets the chart area color to gray and the plot area color to green.

With myChart

    .PlotArea.Interior.Color = RGB(0, 100, 150)

    .ChartArea.Interior.Color = RGB(50, 10, 50)

End With


AxisTitle, ChartArea, ChartTitle, DataLabel, DataLabels, DownBars, Floor, Legend, LegendKey, PlotArea, Point, Series, UpBars, Walls


Legend Object

Represents the legend in the specified chart. Each chart can have only one legend.The Legend object contains one or more LegendEntry objects; each LegendEntry object contains a LegendKey object.

Using the Legend Object

Use the Legend property to return the Legend object. The following example sets the font style for the legend to bold.

myChart.Legend.Font.Bold = True

Remarks

The chart legend isn't visible unless the HasLegend property is True. If this property is False, properties and methods of the Legend object will fail.


LegendEntry Object

Represents a legend entry in the specified chart legend. The LegendEntry object is a member of the LegendEntries collection, which contains all the LegendEntry objects in the legend.

Each legend entry has two parts: the text of the entry, which is the name of the series associated with the entry; and an entry marker, which visually links the legend entry with its associated series or trendline in the chart. Formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

You cannot change the text of a legend entry. LegendEntry objects support font formatting, and they can be deleted. No pattern formatting is supported for legend entries. The position and size of entries is fixed.

Using the LegendEntry Object

Use LegendEntries(index), where index is the legend entry's index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend, and LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style for the text of the legend entry at the top of the legend (this is usually the legend for series one).

myChart.Legend.LegendEntries(1).Font.Italic = True

Remarks

There's no direct way to return the series or trendline that corresponds to a particular legend entry.

After legend entries have been deleted, the only way to restore them is to remove and then recreate the legend that contained them by setting the HasLegend property for the chart to False and then back to True.


PlotArea Object

Represents the plot area of the specified chart. This is the area where your chart data is plotted. The plot area in a 2-D chart contains the data markers, gridlines, data labels, trendlines, and optional chart items placed in the chart area. The plot area in a 3-D chart contains all the above items plus the walls, floor, axes, axis titles, and tick-mark labels in the chart.

The plot area is surrounded by the chart area. The chart area in a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area in a 3-D chart contains the chart title and the legend. For information about formatting the chart area, see the ChartArea object.

Using the PlotArea Object

Use the PlotArea property to return the PlotArea object. The following example places a dashed border around the chart area and places a dotted border around the plot area.

With myChart

    .ChartArea.Border.LineStyle = xlDash

    .PlotArea.Border.LineStyle = xlDot

End With


Point Object

Represents a single point in a series on the specified chart. The Point object is a member of the Points collection, which contains all the points in the specified series.

Using the Point Object

Use Points(index), where index is the point's index number, to return a single Point object. Points are numbered from left to right in the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one. For this example to work, series one must be a 2-D line, scatter, or radar series.

myChart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond


Range Object

Represents a cell, a row, a column, or a selection of cells that contains one or more contiguous blocks of cells.

Using the Range Object

The following properties for returning a Range object are described in this section:

•	Range property

•	Cells property

Range Property

Use Range(arg), where arg is the name of the range, to return a Range object that represents a single cell or a range of cells. The following example places the value of cell A1 in cell A5.

myChart.Application.DataSheet.Range("A5").Value = _

    myChart.Application.DataSheet.Range("A1").Value

The following example fills the range A1:H8 with the value 20.

myChart.Application.DataSheet.Range("A1:H8").Value = 20

Cells Property

Use Cells(row, column), where row is the row's index number and column is the column's index number, to return a single cell. The following example sets the value of cell A1 to 24 (column A is the second column on the datasheet, and row 1 is the second row on the datasheet).

myChart.Application.DataSheet.Cells(2, 2).Value = 24

Although you can also use Range("A1") to return cell A1, there may be times when the Cells property is more convenient because you can use a variable for the row or column. The following example creates column and row headings on the datasheet.

Sub SetUpTable()

With myChart.Application.DataSheet

    For theYear = 1 To 5

        .Cells(1, theYear + 1).Value = 1990 + theYear

    Next theYear

'

    For theQuarter = 1 To 4

        .Cells(theQuarter + 1, 1).Value = "Q" & theQuarter

    Next theQuarter

End With

End Sub

Although you can use Visual Basic string functions to alter A1-style references, it's much easier (and much better programming practice) to use the Cells(1, 1) notation.

Use expression.Cells(row, column), where expression is an expression that returns a Range object, and row and column are relative to the upper-left corner of the range, to return part of a range. The following example sets the value for cell C5.

myChart.Application.Range("c5:c10").Cells(1, 1).Value = 35


Series Object

Represents a series in the specified chart. The Series object is a member of the SeriesCollection collection.

Using the Series Object

Use SeriesCollection(index), where index is the series' index number or name, to return a single Series object. The following example sets the color of the interior for series one in the chart.

myChart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)

The series index number indicates the order in which the series are added to the chart. SeriesCollection(1) is the first series added to the chart, and SeriesCollection(SeriesCollection.Count) is the last one added.


TickLabels Object

Represents the tick-mark labels associated with tick marks on the specified chart axis. This object isn't a collection. There's no object that represents a single tick-mark label; you must return all the tick-mark labels as a unit.

Tick-mark label text for the category axis comes from the name of the associated category in the chart. The default tick-mark label text for the category axis is the number that indicates the position of the category relative to the left end of this axis. To change the number of unlabeled tick marks between tick-mark labels, you must change the TickLabelSpacing property for the category axis.

Tick-mark label text for the value axis is calculated based on the MajorUnit, MinimumScale, and MaximumScale properties of the value axis. To change the tick-mark label text for the value axis, you must change the values of these properties.

Using the TickLabels Object

Use the TickLabels property to return the TickLabels object. The following example sets the number format for the tick-mark labels on the value axis in the chart.

myChart.Axes(xlValue).TickLabels.NumberFormat = "0.00"


Trendline Object

Represents a trendline in the specified chart. A trendline shows the trend, or direction, of data in a series. The Trendline object is a member of the Trendlines collection, which contains all the Trendline objects for a single series.

Using the Trendline Object

Use Trendlines(index), where index is the trendline's index number, to return a single Trendline object. The following example changes the trendline type for series one in the chart. If the series has no trendline, this example will fail.

myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

The index number denotes the order in which the trendlines are added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.


UpBars Object

Represents the up bars in a chart group. Up bars connect points in series one with higher values in the last series in the chart group (the lines go up from series one). Only 2-D line groups that contain at least two series can have up bars. This object isn't a collection. There's no object that represents a single up bar; either you have up bars turned on for all points in a chart group or you have them turned off.

Using the UpBars Object

Use the UpBars property to return the UpBars object. The following example turns on up and down bars for chart group one in the chart. The example then sets the up-bar color to blue and sets the down-bar color to red.

With myChart.ChartGroups(1)

    .HasUpDownBars = True

    .UpBars.Interior.Color = RGB(0, 0, 255)

    .DownBars.Interior.Color = RGB(255, 0, 0)

End With

Remarks

If the HasUpDownBars property is False, most properties of the UpBars object are disabled.


Walls Object

Represents the walls of the specified 3-D chart. This object isn't a collection. There's no object that represents a single wall; you must return all the walls as a unit.

Using the Walls Object

Use the Walls property to return the Walls object. The following example sets the pattern on the walls for the chart. If the chart isn't a 3-D chart, this example will fail.

myChart.Walls.Interior.Pattern = xlGray75


Application Object

Represents the entire Microsoft Graph application. The Application object represents the top level of the object hierarchy and contains all of the objects, properties, and methods for the application.

Using the Application Object

Use the Application property to return the Application object. The following example applies the DataSheet property to the Application object.

myChart.Application.DataSheet.Range("A1").Value = 32


AutoCorrect, Chart, DataSheet


Axes Collection Object

A collection of all the Axis objects in the specified chart.

Using the Axes Collection

Use the Axes method to return the Axes collection. The following example displays the number of axes in the chart.

With myChart

    MsgBox .Axes.Count

End With

Use Axes(type, group), where type is the axis type and group is the axis group, to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. Group can be either of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

The following example sets the title text for the category axis.

With myChart.Axes(xlCategory)

    .HasTitle = True

    .AxisTitle.Caption = "1994"

End With


ChartArea Object

Represents the chart area of the specified chart. The chart area in a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area in a 3-D chart contains the chart title and the legend; it doesn't include the plot area (the area within the chart area where the data is plotted). For information about formatting the plot area, see the PlotArea object.

Using the ChartArea Object

Use the ChartArea property to return the ChartArea object. The following example sets the pattern for the chart area.

myChart.ChartArea.Interior.Pattern = xlLightDown


ChartGroups Collection Object

A collection of all the ChartGroup objects in the specified chart. Each ChartGroup object represents one or more series plotted with the same format in a chart. A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format.

Using the ChartGroups Collection

Use the ChartGroups method to return the ChartGroups collection. The following example displays the number of chart groups in the chart

MsgBox myChart.ChartGroups.Count

Use ChartGroups(index), where index is the chart group's index number, to return a single ChartGroup object. The following example adds drop lines to chart group one in the chart.

myChart.ChartGroups(1).HasDropLines = True

Because the index number for a particular chart group can change if the chart format used for that group is changed, it may be easier to use one of the named chart-group shortcut methods to return a particular chart group. The PieGroups method returns the collection of pie chart groups in the specified chart, the LineGroups method returns the collection of line chart groups, and so on. Each of these methods can be used with an index number to return a single ChartGroup object, or used without an index number to return a ChartGroups collection. The following methods are available for chart groups:

•	AreaGroups method

•	BarGroups method

•	ColumnGroups method

•	DoughnutGroups method

•	LineGroups method

•	PieGroups method


ChartTitle Object

Represents the title of the specified chart.

Using the ChartTitle Object

Use the ChartTitle property to return the ChartTitle object. The following example adds a title to the chart.

With myChart

    .HasTitle = True

    .ChartTitle.Text = "February Sales"

End With

Remarks

The ChartTitle object doesn't exist and cannot be used unless the HasTitle property for the chart is True.


Corners Object

Represents the corners of the specified 3-D chart. This object isn't a collection.

Using the Corners Object

Use the Corners property to return the Corners object. The following example selects the corners of the chart.

myChart.Corners.Select

If the chart isn't a 3-D chart, the Corners property fails.


DataLabels Collection Object

A collection of all the DataLabel objects for the specified series. Each DataLabel object represents a data label for a point or trendline. For a series without definable points (such as an area series), the DataLabels collection contains a single data label.

Using the DataLabels Collection

Use the DataLabels method to return the DataLabels collection. The following example sets the number format for data labels in series one in the chart.

With myChart.SeriesCollection(1)

    .HasDataLabels = True

    .DataLabels.NumberFormat = "##.##"

End With

Use DataLabels(index), where index is the data label's index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in series one in the chart.

myChart.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"


DownBars Object

Represents the down bars in the specified chart group. Down bars connect points in the first series in the chart group with lower values in the last series (the lines go down from the first series). Only 2-D line groups that contain at least two series can have down bars. This object isn't a collection. There's no object that represents a single down bar; either you have up bars and down bars turned on for all points in a chart group or you have them turned off.

Using the DownBars Object

Use the DownBars property to return the DownBars object. The following example turns on up and down bars for chart group one in the chart. The example then sets the up-bar color to blue and the down-bar color to red.

With myChart.ChartGroups(1)

    .HasUpDownBars = True

    .UpBars.Interior.Color = RGB(0, 0, 255)

    .DownBars.Interior.Color = RGB(255, 0, 0)

End With

Remarks

If the HasUpDownBars property is False, most properties of the DownBars object are disabled.


DropLines Object

Represents the drop lines in the specified chart group. Drop lines connect the points in the chart with the x-axis. Only line and area chart groups can have drop lines. This object isn't a collection. There's no object that represents a single drop line; either you have drop lines turned on for all points in a chart group or you have them turned off.

Using the DropLines Object

Use the DropLines property to return the DropLines object. The following example turns on drop lines for chart group one in the chart and then sets the drop-line color to red.

myChart.ChartGroups(1).HasDropLines = True

myChart.ChartGroups(1).DropLines.Border.ColorIndex = 3

Remarks

If the HasDropLines property is False, most properties of the DropLines object are disabled.


Floor Object

Represents the floor of the specified 3-D chart.

Using the Floor Object

Use the Floor property to return the Floor object. The following example sets the floor color for the chart to cyan. If the chart isn't a 3-D chart, this example will fail.

myChart.Floor.Interior.Color = RGB(0, 255, 255)


Gridlines Object

Represents major or minor gridlines on the specified chart axis. Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. This object isn't a collection. There's no object that represents a single gridline; either you have all gridlines for an axis turned on or you have them all turned off.

Using the Gridlines Object

Use the MajorGridlines property to return the GridLines object that represents the major gridlines for the axis. Use the MinorGridlines property to return the GridLines object that represents the minor gridlines for the axis. It's possible to return both major and minor gridlines at the same time.

The following example turns on major gridlines for the category axis on the chart and then formats the gridlines to be blue dashed lines.

With myChart.Axes(xlCategory)

.HasMajorGridlines = True

.MajorGridlines.Border.Color = RGB(0, 0, 255)

.MajorGridlines.Border.LineStyle = xlDash

End With


HiLoLines Object

Represents the high-low lines in the specified chart group. High-low lines connect the highest point with the lowest point in every category in the chart group. Only 2-D line groups can have high-low lines. This object isn't a collection. There's no object that represents a single high-low line; either you have high-low lines turned on for all points in a chart group or you have them turned off.

Using the HiLoLines Object

Use the HiLoLines property to return the HiLoLines object. The following example makes the high-low lines in chart group one in the chart blue.

myChart.ChartGroups(1).HiLoLines.Border.Color = RGB(0, 0, 255)

Remarks

If the HasHiLoLines property is False, most properties of the HiLoLines object are disabled.


LeaderLines Object

Represents leader lines in the specified chart. Leader lines connect data labels to data points. This object isn't a collection; there's no object that represents a single leader line.

Using the LeaderLines Object

Use the LeaderLines property to return the LeaderLines object. The following example adds data labels and blue leader lines to series one in the chart.

With myChart.SeriesCollection(1)

.HasDataLabels = True

.DataLabels.Position = xlLabelPositionBestFit

.HasLeaderLines = True

.LeaderLines.Border.ColorIndex = 5

End With


LegendEntries Collection Object

A collection of all the LegendEntry objects in the specified chart legend. Each legend entry has two parts: the text of the entry, which is the name of the series or trendline associated with the entry; and the entry marker, which visually links the legend entry with its associated series or trendline in the chart. The formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

Using the LegendEntries Collection

Use the LegendEntries method to return the LegendEntries collection. The following example loops through the collection of legend entries in the chart and changes their font color to blue.

With myChart.Legend

    For i = 1 To .LegendEntries.Count

        .LegendEntries(i).Font.ColorIndex = 5

    Next

End With

Use LegendEntries(index), where index is the legend entry's index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend; LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style to italic for the text of the legend entry at the top of the legend (this is usually the legend for series one) in embedded chart one.

myChart.Legend.LegendEntries(1).Font.Italic = True


LegendKey Object

Represents a legend key in the specified chart legend. Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.

Using the LegendKey Object

Use the LegendKey property to return the LegendKey object. The following example changes the marker background color to blue for the legend entry at the top of the legend in the chart. This simultaneously changes the formatting of every point in the series associated with this legend entry (if, that is, the associated series supports data markers).

myChart.Legend.LegendEntries(1).LegendKey.MarkerBackgroundColorIndex = 5


Points Collection Object

A collection of all the Point objects in the specified series in a chart.

Using the Points Collection

Use the Points method to return the Points collection. The following example adds a data label to the last point in series one in the chart.

Dim pts As Points

Set pts = myChart.SeriesCollection(1).Points

pts(pts.Count).ApplyDataLabels Type:=xlShowValue

Use Points(index), where index is the point's index number, to return a single Point object. Points are numbered from left to right in the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one in the chart. The specified series must be a 2-D line, scatter, or radar series.

myChart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond


SeriesCollection Collection Object

A collection of all the Series objects in the specified chart or chart group.

Using the SeriesCollection Collection

Use the SeriesCollection method to return the SeriesCollection collection. The following example adjusts the interior color for each series in the collection:

For X = 1 To myChart.SeriesCollection.Count

    With myChart.SeriesCollection(X)

        .Interior.Color = RGB(X * 75, 50, X * 50)

    End With

Next X

Use SeriesCollection(index), where index is the series' index number or name, to return a single Series object. The following example sets the color of the interior for series one in the chart to red.

myChart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)


SeriesLines Object

Represents series lines in the specified chart group. Series lines connect the data values in each series. Only 2-D stacked-bar or column chart groups can have series lines. This object isn't a collection. There's no object that represents a single series line; either you have series lines turned on for all points in a chart group or you have them turned off.

Using the SeriesLines Object

Use the SeriesLines property to return the SeriesLines object. The following example adds series lines to chart group one in the chart. The chart must be a 2-D stacked-bar or column chart.

With myChart.ChartGroups(1)

    .HasSeriesLines = True

    .SeriesLines.Border.Color = RGB(0, 0, 255)

End With

Remarks

If the HasSeriesLines property is False, most properties of the SeriesLines object are disabled.


Trendlines Collection Object

A collection of all the Trendline objects for the specified series. Each Trendline object represents a trendline in a chart. A trendline shows the trend, or direction, of data in a series.

Using the Trendlines Collection

Use the Trendlines method to return the Trendlines collection. The following example displays the number of trendlines for series one in the chart.

MsgBox myChart.SeriesCollection(1).Trendlines.Count

Use the Add method to create a new trendline and add it to the series. The following example adds a linear trendline to series one in the chart.

With myChart.SeriesCollection(1).Trendlines

    .Add Type:=xlLinear, Name:="Linear Trend"

End With

Use Trendlines(index), where index is the trendline's index number, to return a single TrendLine object. The following example changes the trendline type for series one in the chart. If the series has no trendline, this example will fail.

myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg

The index number denotes the order in which the trendlines are added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.


DataSheet Object

Represents the Microsoft Graph datasheet.

Using the DataSheet Object

After you've established a reference to a chart, you can use the Application property of the chart to retrieve the datasheet. The following example applies the DataSheet property to the Application object, and and then it applies the Range property to the datasheet to set the value of cell A1 to 32.

myChart.Application.DataSheet.Range("A1").Value = 32

Remarks

On the datasheet, the first column heading (starting on the left) is A, followed by B, C, D, and so on. The first row heading (starting on the left) is 1, followed by 2, 3, 4, and so on. Neither the leftmost column nor the top row has a heading. In other words, column A is actually the second column from the left; likewise, row 1 is the second row from the top. The leftmost column and the top row, which are commonly used for legend text or axis labels, are referred to as column 0 (zero) and row 0 (zero). Thus, the following example inserts the text "Annual Sales" in the top cell in column A (the second column).

myChart.Application.DataSheet.Range("A0").Value = "Annual Sales"

And the following example inserts the text "District 1" in the leftmost cell in row 2 (the third row).

myChart.Application.DataSheet.Range("02").Value = "District 1"


Activate Method

Activates the object.

Syntax

expression.Activate

expression   Required. An expression that returns an object in the Applies To list.


Activate Method Example

This example activates the datasheet.

myChart.Application.DataSheet.Activate


AddChartAutoFormat Method

Adds a custom chart autoformat to the list of available chart autoformats.

Syntax

expression.AddChartAutoFormat(Name, Description)

expression   Required. An expression that returns an Application object.

Name   Required String. The name of the autoformat.

Description   Optional String. A description of the custom autoformat.


AddChartAutoFormat Method Example

This example adds a new autoformat.

myChart.Application.AddChartAutoFormat _

Name:="Presentation Chart"


AddReplacement Method

Adds an entry to the array of AutoCorrect replacements.

Syntax

expression.AddReplacement(What, Replacement)

expression   Required. An expression that returns an AutoCorrect object.

What   Required String. The text to be replaced. If this string already exists in the array of AutoCorrect replacements, the existing substitute text is replaced by the new text.

Replacement   Required String. The replacement text.


AddReplacement Method Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

With myChart.Application.AutoCorrect

.AddReplacement "Temperature", "Temp."

End With


Application Property

Returns an Application object that represents the Microsoft Graph application.


Application Property Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

With myChart.Application.AutoCorrect

.AddReplacement "Temperature", "Temp."

End With


ApplyCustomType Method

Applies a standard or custom chart type to a chart or series.

Syntax

expression.ApplyCustomType(ChartType, TypeName)

expression   An expression that returns a Chart or Series object.

ChartType   Required Long. A standard chart type (see the ChartType property for the list of available constants). For Chart objects, this can also be one of the following XlChartGallery constants: xlBuiltIn, xlUserDefined, or xlAnyGallery.

TypeName   Opional Variant (used only with Chart objects). A String naming the custom chart type when ChartType specifies a custom chart gallery.


ApplyCustomType Method Example

This example applies the line with the markers chart type.

myChart.ApplyCustomType xlLineMarkers


ApplyDataLabels Method

Applies data labels to a point, a series, or all the series in a chart.

Syntax

expression.ApplyDataLabels(Type, LegendKey)

expression   Required. An expression that returns a Chart, Point, or Series object.

Type   Optional Variant. The data label type. Can be one of the following XlDataLabelsType constants.

Constant	Description
xlDataLabelsShowNone	No data labels.
xlDataLabelsShowValue	Value for the point (assumed if this argument isn't specified).
xlDataLabelsShowPercent	Percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowLabel	Category for the point. This is the default value.
xlDataLabelsShowLabelAndPercent	Percentage of the total, and category for the point. Available only for pie charts and doughnut charts.
LegendKey   Optional Variant. True to show the legend key next to the point. The default value is False.


ApplyDataLabels Method Example

This example applies category labels to series one.

myChart.SeriesCollection(1). _

ApplyDataLabels Type:=xlDataLabelsShowLabel


ApplyPictToEnd Property

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.


ApplyPictToEnd Property Example

This example applies pictures to the end of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

myChart.SeriesCollection(1).ApplyPictToEnd = True


ApplyPictToFront Property

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.


ApplyPictToFront Property Example

This example applies pictures to the front of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

myChart.SeriesCollection(1).ApplyPictToFront = True


ApplyPictToSides Property

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.


ApplyPictToSides Property Example

This example applies pictures to the sides of all points in series one. The series must already have pictures applied to it (setting this property changes the picture orientation).

myChart.SeriesCollection(1).ApplyPictToSides = True


AutoCorrect Property

Returns an AutoCorrect object that represents the Microsoft Graph AutoCorrect attributes. Read-only.


AutoCorrect Property Example

This example substitutes the word "Temp." for the word "Temperature" in the array of AutoCorrect replacements.

With myChart.Application.AutoCorrect

.AddReplacement "Temperature", "Temp."

End With


AutoScaleFont Property

True if the text in the object changes font size when the object size changes. The default value is True. Read/write Variant.


AutoScaleFont Property Example

This example adds a title to the chart, and it causes the title font to remain the same size whenever the chart size changes.

With myChart

.HasTitle = True

.ChartTitle.Text = "1996 sales"

.ChartTitle.AutoScaleFont = False

End With


AutoScaling Property

True if Microsoft Graph scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.


AutoScaling Property Example

This example automatically scales the chart. The example should be run on a 3-D chart.

With myChart

.RightAngleAxes = True

.AutoScaling = True

End With


AutoText Property

True if the object automatically generates appropriate text based on context. Read/write Boolean.


AutoText Property Example

This example sets the data labels for series one to automatically generate appropriate text.

myChart.SeriesCollection(1).DataLabels.AutoText = True


Axes Method

Returns an object that represents either a single axis (an Axis object, Syntax 1) or a collection of the axes on the chart (an Axes collection, Syntax 2).

Syntax 1

expression.Axes(Type, AxisGroup)

Syntax 2

expression.Axes

expression   Required. An expression that returns a Chart object.

Type   Optional Variant. Specifies the axis to return. Can be one of the following XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3-D charts).

AxisGroup   Optional Variant. Specifies the axis group. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary. If this argument is omitted, the primary group is used. 3-D charts have only one axis group.


Axes Method Example

This example adds an axis label to the category axis.

With myChart.Axes(xlCategory)

.HasTitle = True

.AxisTitle.Text = "July Sales"

End With

This example turns off major gridlines for the category axis.

myChart.Axes(xlCategory).HasMajorGridlines = False

This example turns off all gridlines for all axes.

For Each a In myChart.Axes

a.HasMajorGridlines = False

a.HasMinorGridlines = False

Next a


AxisBetweenCategories Property

True if the value axis crosses the category axis between categories. Read/write Boolean.

Remarks

This property applies only to category axes, and it doesn't apply to 3-D charts.


AxisBetweenCategories Property Example

This example causes the value axis in to cross the category axis between categories.

myChart.Axes(xlCategory).AxisBetweenCategories = True


AxisGroup Property

Returns the group for the specified axis, chart group, or series. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary. Read/write Long for Series; read-only Long for Axis and ChartGroup.

Remarks

For 3-D charts, only xlPrimary is valid.


AxisGroup Property Example

This example deletes the value axis if it's in the secondary group.

With myChart.Axes(xlValue)

If .AxisGroup = xlSecondary Then .Delete

End With


AxisTitle Property

Returns an AxisTitle object that represents the title of the specified axis. Read-only.


AxisTitle Property Example

This example adds an axis label to the category axis in Chart1.

With myChart.Axes(xlCategory)

.HasTitle = True

.AxisTitle.Text = "July Sales"

End With


BackColor Property

Returns a ChartColorFormat object that represents the fill background color.


BackColor Property Example

This example sets the gradient, background color, and foreground color for the chart area fill.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


Background Property

Returns or sets the text background type. Can be one of the following XlBackground constants: xlBackgroundAutomatic, xlBackgroundOpaque, or xlBackgroundTransparent. This property is used only for text on charts. Read/write Long.


Background Property Example

This example adds a chart title and then sets the font size and background type for the title.

With myChart

.HasTitle = True

.ChartTitle.Text = "1995 Rainfall Totals by Month"

With .ChartTitle.Font

.Size = 10

.Background = xlBackgroundTransparent

End With

End With


Backward Property

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Long


Backward Property Example

This example sets the number of units that the trendline extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

With myChart.SeriesCollection(1).Trendlines(1)

.Forward = 5

.Backward = .5

End With


BaseUnit Property

Returns or sets the base unit for the specified category axis. Can be one of the following XlTimeUnit constants: xlDays, xlMonths, or xlYears. Read/write Long.

Remarks

Setting this property has no visible effect if the CategoryType property for the specified axis is set to xlCategoryScale. The set value is retained, however, and takes effect when the CategoryType property is set to xlTimeScale.

You cannot set this property for a value axis.


BaseUnit Property Example

This example sets the category axis on the chart to use a time scale, with months as the base unit.

With myChart

With .Axes(xlCategory)

.CategoryType = xlTimeScale

.BaseUnit = xlMonths

End With

End With


BaseUnitIsAuto Property

True if Microsoft Graph chooses appropriate base units for the specified category axis. The default value is True. Read/write Boolean.

Remarks

You cannot set this property for a value axis.


BaseUnitIsAuto Property Example

This example sets the category axis on the chart to use a time scale with automatic base units.

With myChart

With .Axes(xlCategory)

.CategoryType = xlTimeScale

.BaseUnitIsAuto = True

End With

End With


Bold Property

True if the font style is bold. Read/write Variant.


Bold Property Example

This example sets the font style to bold for the chart title.

myChart.ChartTitle.Font.Bold = True


Border Property

Returns a Border object that represents the border of the object. Read-only.


Border Property Example

This example sets the color of the chart area border to red.

myChart.ChartArea.Border.ColorIndex = 3


BubbleScale Property

Returns or sets the scale factor for bubbles in the specified chart group. Can be an integer value from 0 (zero) to 300, corresponding to a percentage of the default size. Applies only to bubble charts. Read/write Long.


BubbleScale Property Example

This example sets the bubble size in chart group one to 200 percent of the default size.

With myChart

.ChartGroups(1).BubbleScale = 200

End With


CapitalizeNamesOfDays Property

True if the first letter of day names is capitalized automatically. Read/write Boolean.


CapitalizeNamesOfDays Property Example

This example sets Microsoft Graph to capitalize the first letter of the names of days.

With myChart.Application.AutoCorrect

.CapitalizeNamesOfDays = True

.ReplaceText = True

End With


Caption Property

Returns text with one of several different meanings, depending on the object type to which Caption is applied. Read/write String.

Object type	Meaning
AxisTitle	The axis title text
ChartTitle	The chart title text
DataLabel	The data label text


Caption Property Example

This example adds the title "Annual Salary Figures" to the chart.

myChart.HasTitle = True

myChart.ChartTitle.Caption = "Annual Salary Figures"


CategoryType Property

Returns or sets the category axis type. Can be one of the following XlCategoryType constants: xlCategoryScale, xlTimeScale, or xlAutomaticScale. Read/write Long.

Remarks

You cannot set this property for a value axis.


CategoryType Property Example

This example sets the category axis on the chart to use a time scale, with months as the base unit.

With myChart

With .Axes(xlCategory)

.CategoryType = xlTimeScale

.BaseUnit = xlMonths

End With

End With


CellDragAndDrop Property

True if dragging and dropping cells is enabled. Read/write Boolean.


CellDragAndDrop Property Example

This example enables dragging and dropping cells.

myChart.Application.CellDragAndDrop = True


ChartArea Property

Returns a ChartArea object that represents the complete chart area for the chart. Read-only.


ChartArea Property Example

This example sets the chart area interior color of Chart1 to red and sets the border color to blue.

With myChart.ChartArea

.Interior.ColorIndex = 3

.Border.ColorIndex = 5

End With


ChartGroups Method

Returns an object that represents either a single chart group (a ChartGroup object, Syntax 1) or a collection of all the chart groups in the chart (a ChartGroups object, Syntax 2). The returned collection includes every type of group.

Syntax 1

expression.ChartGroups(Index)

Syntax 2

expression.ChartGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. The chart group number.


ChartGroups Method Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that intersect at one or more data points.

With myChart.ChartGroups(1)

.HasUpDownBars = True

.DownBars.Interior.ColorIndex = 3

.UpBars.Interior.ColorIndex = 5

End With


ChartTitle Property

Returns a ChartTitle object that represents the title of the specified chart. Read-only.


ChartTitle Property Example

This example sets the text for the title of the chart.

With myChart

.HasTitle = True

.ChartTitle.Text = "First Quarter Sales"

End With


ChartType Property

Returns or sets the chart type. Read/write Long.

Can be one of the following XlChartType constants.

Chart type	Description	Constant
Column	Clustered Column	xlColumnClustered
	3-D Clustered Column	xl3DColumnClustered
	Stacked Column	xlColumnStacked
	3-D Stacked Column	xl3DColumnStacked
	100% Stacked Column	xlColumnStacked100
	3-D 100% Stacked Column	xl3DColumnStacked100
	3-D Column	xl3DColumn
Bar	Clustered Bar	xlBarClustered
	3-D Clustered Bar	xl3DBarClustered
	Stacked Bar	xlBarStacked
	3-D Stacked Bar	xl3DBarStacked
	100% Stacked Bar	xlBarStacked100
	3-D 100% Stacked Bar	xl3DBarStacked100
Line	Line	xlLine
	Line with Markers	xlLineMarkers
	Stacked Line	xlLineStacked
	Stacked Line with Markers	xlLineMarkersStacked
	100% Stacked Line	xlLineStacked100
	100% Stacked Line with Markers	xlLIneMarkersStacked100
	3-D Line	xl3DLine
Pie	Pie	xlPie
	Exploded Pie	xlPieExploded
	3-D Pie	xl3Dpie
	Exploded 3-D Pie	xl3DPieExploded
	Pie of Pie	xlPieOfPie
	Bar of Pie	xlBarOfPie
XY (Scatter)	Scatter	xlXYScatter
	Scatter with Smoothed Lines	xlXYScatterSmooth
	Scatter with Smoothed Lines and No Data Markers	xlXYScatterSmoothNoMarkers
	Scatter with Lines	xlXYScatterLines
	Scatter with Lines and No Data Markers	xlXYScatterLinesNoMarkers
Bubble	Bubble	xlBubble
	Bubble with 3-D Effects	xlBubble3DEffect
Area	Area	xlArea
	3-D Area	xl3DArea
	Stacked Area	xlAreaStacked
	3-D Stacked Area	xl3DAreaStacked
	100% Stacked Area	xlAreaStacked100
	3-D 100% Stacked Area	xl3DAreaStacked100
Doughnut	Doughnut	xlDoughnut
	Exploded Doughnut	xlDoughnutExploded
Radar	Radar	xlRadar
	Radar with Data Markers	xlRadarMarkers
	Filled Radar	xlRadarFilled
Surface	3-D Surface	xlSurface
	Surface (Top View)	xlSurfaceTopView
	3-D Surface (wire-frame)	xlSurfaceWireframe
	Surface (Top View wire-frame)	xlSurfaceTopViewWireframe
Stock Quotes	High-Low-Close	xlStockHLC
	Volume-High-Low-Close	xlStockVHLC
	Open-High-Low-Close	xlStockOHLC
	Volume-Open-High-Low-Close	xlStockVOHLC
Cylinder	Clustered Cylinder Column	xlCylinderColClustered
	Clustered Cylinder Bar	xlCylinderBarClustered
	Stacked Cylinder Column	xlCylinderColStacked
	Stacked Cylinder Bar	xlCylinderBarStacked
	100% Stacked Cylinder Column	xlCylinderColStacked100
	100% Stacked Cylinder Bar	xlCylinderBarStacked100
	3-D Cylinder Column	xlCylinderCol
Cone	Clustered Cone Column	xlConeColClustered
	Clustered Cone Bar	xlConeBarClustered
	Stacked Cone Column	xlConeColStacked
	Stacked Cone Bar	xlConeBarStacked
	100% Stacked Cone Column	xlConeColStacked100
	100% Stacked Cone Bar	xlConeBarStacked100
	3-D Cone Column	xlConeCol
Pyramid	Clustered Pyramid Column	xlPyramidColClustered
	Clustered Pyramid Bar	xlPyramidBarClustered
	Stacked Pyramid Column	xlPyramidColStacked
	Stacked Pyramid Bar	xlPyramidBarStacked
	100% Stacked Pyramid Column	xlPyramidColStacked100
	100% Stacked Pyramid Bar	xlPyramidBarStacked100
	3-D Pyramid Column	xlPyramidCol


ChartType Property Example

This example sets the bubble size in chart group one to 200 percent of the default size if the chart is a 2-D bubble chart.

With myChart

If .ChartType = xlBubble Then

.ChartGroups(1).BubbleScale = 200

End If

End With


Clear Method

Clears the entire range or chart area.

Syntax

expression.Clear

expression   Required. An expression that returns a ChartArea or Range object.


Clear Method Example

This example clears the formulas and formatting in cells A1:G37 on the datasheet.

myChart.Application.DataSheet.Range("A1:G37").Clear

This example clears the chart area (the chart data and formatting) of Chart1.

myChart.ChartArea.Clear


ClearContents Method

Clears the formulas from the range. Clears the data from a chart but leaves the formatting.

Syntax

expression.ClearContents

expression   Required. An expression that returns a Chart or Range object.


ClearContents Method Example

This example clears the formulas from cells A1:G37 on the datasheet but leaves the formatting intact.

myChart.Application.DataSheet.Range("A1:G37").ClearContents

This example clears the chart data from a chart but leaves the formatting intact.

myChart.ChartArea.ClearContents


ClearFormats Method

Clears the formatting of the object.

Syntax

expression.ClearFormats

expression   Required. An expression that returns an object in the Applies To list.


ClearFormats Method Example

This example clears all formatting from cells A1:G37 on the datasheet.

myChart.Application.DataSheet.Range("A1:G37").ClearFormats

This example clears the formatting from the chart.

myChart.ChartArea.ClearFormats


Color Property

Returns or sets the primary color of the object, as shown in the following table. Use the RGB function to create a color value. Read/write Long.

Object	Color
Border	The color of the border.
Font	The color of the font.
Interior	The cell shading color or the drawing object fill color.


Color Property Example

This example sets the color of the tick-mark labels on the value axis.

myChart.Axes(xlValue).TickLabels.Font.Color = RGB(0, 255, 0)


ColorIndex Property

Returns or sets the color of the border or interior, as shown in the following table. The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Variant.

Object	Description
Border	The color of the border.
Interior	The color of the interior fill. Set ColorIndex to xlColorIndexNone to specify that you don't want an interior fill. Set ColorIndex to xlColorIndexAutomatic to specify the automatic fill (for drawing objects).
Remarks

This property specifies a color as an index into the color palette. The following illustration shows the color-index values in the default color palette.


ColorIndex Property Example

The following examples assume that you're using the default color palette.

This example sets the color of the major gridlines for the value axis.

With myChart.Axes(xlValue)

If .HasMajorGridlines Then

.MajorGridlines.Border.ColorIndex = 5	'set color to blue

End If

End With

This example sets the color of the chart area interior to red and sets the border color to blue.

With myChart.ChartArea

.Interior.ColorIndex = 3

.Border.ColorIndex = 5

End With


Columns Property

Range object: Returns a Range object that represents the columns in the specified range. Read-only.

DataSheet object: Returns a Range object that represents all the columns on the datasheet. Read-only.

For information about returning a single member of a collection, see Returning an Object from a Collection.


Columns Property Example

This example clears column A of the datasheet.

myChart.Application.DataSheet.Columns(2).ClearContents


ColumnWidth Property

Returns or sets the width of all columns in the specified range. Read/write Variant.

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

If all columns in the range have the same width, the ColumnWidth property returns the width. If columns in the range have different widths, this property returns Null.


ColumnWidth Property Example

This example doubles the width of column A on the datasheet.

With myChart.Application.DataSheet.Columns("A")

.ColumnWidth = .ColumnWidth * 2

End With


CommandBars Property

Returns a CommandBars object that represents the Microsoft Graph command bars. Read-only.


CommandBars Property Example

This example deletes all custom command bars that aren't visible.

For Each bar In myChart.Application.CommandBars

    If Not bar.BuiltIn And Not bar.Visible Then bar.Delete

Next


Copy Method

Syntax 1: Copies the object to the Clipboard. Copies a picture of the point or series to the Clipboard.

Syntax 2: Copies the Range to the specified range or to the Clipboard.

Syntax 1

expression.Copy

Syntax 2

expression.Copy(Destination)

expression   Required. An expression that returns an object in the Applies To list.

Destination   Optional Variant. Specifies the new range to which the specified range will be copied. If this argument is omitted, Microsoft Graph copies the range to the Clipboard.


Copy Method Example

This example copies the formulas in cells A1:D4 on the datasheet into cells E5:H8.

Set mySheet = myChart.Application.DataSheet

mySheet.Range("A1:D4").Copy _

Destination:= mySheet.Range("E5")


CorrectCapsLock Property

True if Microsoft Graph automatically corrects accidental use of the CAPS LOCK key. Read/write Boolean.


CorrectCapsLock Property Example

This example enables Microsoft Graph to automatically correct accidental use of the CAPS LOCK key.

myChart.Application.AutoCorrect.CorrectCapsLock = True


CorrectSentenceCap Property

True if Microsoft Graph automatically corrects sentence (first word) capitalization. Read/write Boolean.


CorrectSentenceCap Property Example

This example enables Microsoft Graph to automatically correct sentence capitalization.

myChart.Application.AutoCorrect.CorrectSentenceCap = True


Count Property

Returns the number of objects in the specified collection. Read-only Long.


Count Property Example

This example displays the number of chart groups in the chart.

MsgBox "The chart contains " & myChart.ChartGroups.Count & " chart groups."


Creator Property

Returns a 32-bit integer that indicates the application in which this object was created. If the object was created in Microsoft Graph, this property returns the string MSGR, which is equivalent to the hexadecimal number 4D534752. Read-only Long.

Remarks

The Creator property is designed to be used in Microsoft Graph for the Macintosh, where each application has a four-character creator code.


Creator Property Example

This example displays a message about the creator of myChart.

If myChart.Creator = &h4D534752 Then

MsgBox "This is a Microsoft Graph object"

Else

MsgBox "This is not a Microsoft Graph object"

End If


Crosses Property

Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.

Can be one of the following XlAxisCrosses constants.

Constant	Meaning
xlAxisCrossesAutomatic	Microsoft Graph sets the axis crossing point.
xlMinimum	The axis crosses at the minimum value.
xlMaximum	The axis crosses at the maximum value.
xlAxisCrossesCustom	The CrossesAt property specifies the axis crossing point.
Remarks

This property isn't available for 3-D charts or radar charts.

This property can be used for both category and value axes. On the category axis, xlMinimum sets the value axis to cross at the first category, and xlMaximum sets the value axis to cross at the last category.

Note that xlMinimum and xlMaximum can have different meanings, depending on the axis.


Crosses Property Example

This example sets the value axis to cross the category axis at the maximum x value.

myChart.Axes(xlCategory).Crosses = xlMaximum


CrossesAt Property

Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.

Remarks

Setting this property causes the Crosses property to change to xlAxisCrossesCustom.

This property cannot be used on 3-D charts or radar charts.


CrossesAt Property Example

This example sets the category axis to cross the value axis at value 3.

With myChart.Axes(xlValue)

.Crosses = xlCustom

.CrossesAt = 3

End With


Cut Method

Cuts the specified range to the Clipboard or pastes it into a specified destination.

Syntax

expression.Cut(Destination)

expression   Required. An expression that returns a Range object.

Destination   Optional Variant. The range where the object should be pasted. If this argument is omitted, the object is cut to the Clipboard.


Cut Method Example

This example cuts the range A1:G37 on the datasheet and places it on the Clipboard.

Set mySheet = myChart.Application.DataSheet

mySheet.Range("A1:G37").Cut


DataLabel Property

Returns a DataLabel object that represents the data label associated with the specified point or trendline. Read-only.


DataLabel Property Example

This example turns on the data label for point seven in series three, and then it sets the data label color to blue.

With myChart.SeriesCollection(3).Points(7)

.HasDataLabel = True

.ApplyDataLabels type:=xlValue

.DataLabel.Font.ColorIndex = 5

End With


DataLabels Method

Returns an object that represents either a single data label (a DataLabel object, Syntax 1) or a collection of all the data labels for the series (a DataLabels collection, Syntax 2).

Syntax 1

expression.DataLabels(Index)

Syntax 2

expression.DataLabels

expression   Required. An expression that returns a Series object.

Index   Optional Variant. The number of the data label.


DataLabels Method Example

This example sets the data labels for series one to show their key, assuming that their values are visible when the example runs.

With myChart.SeriesCollection(1)

.HasDataLabels = True

With .DataLabels

.ShowLegendKey = True

.Type = xlValue

End With

End With


DataTable Property

Returns a DataTable object that represents the chart data table. Read-only.


DataTable Property Example

This example adds a data table with an outline border to the chart.

With myChart

.HasDataTable = True

.DataTable.HasBorderOutline = True

End With


Delete Method

Deletes the specified object. Syntax 2 applies only to Range objects.

Syntax 1

expression.Delete

Syntax 2

expression.Delete(Shift)

expression   Required. An expression that returns an object in the Applies To list.

Shift   Optional Variant. Used only with Range objects. Specifies how to shift cells to replace deleted cells. Can be one of the following XlDeleteShiftDirection constants: xlShiftToLeft or xlShiftUp. If this argument is omitted, Microsoft Graph decides based on the shape of the range.

Remarks

Deleting a Point or LegendKey object deletes the entire series.


Delete Method Example

This example deletes cells A1:D10 on the datasheet and shifts the remaining cells to the left.

Set mySheet = myChart.Application.DataSheet

mySheet.Range("A1:D10").Delete Shift:=xlShiftToLeft

This example deletes the chart title.

myChart.ChartTitle.Delete


DeleteChartAutoFormat Method

Removes a custom chart autoformat from the list of available chart autoformats.

Syntax

expression.DeleteChartAutoFormat(Name)

expression   Required. An expression that returns an Application object.

Name   Required String. The name of the custom autoformat to be removed.


DeleteChartAutoFormat Method Example

This example deletes the custom autoformat named "Presentation Chart."

myChart.Application.DeleteChartAutoFormat name:="Presentation Chart"


DepthPercent Property

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.


DepthPercent Property Example

This example sets the depth of the chart to be 50 percent of its width. The example should be run on a 3-D chart (the DepthPercent property fails on 2-D charts).

myChart.DepthPercent = 50


Deselect Method

Cancels the selection for the chart.

Syntax

expression.Deselect

expression   Required. An expression that returns a Chart object.


Deselect Method Example

This example is equivalent to pressing ESC while working on the chart. The example should be run on a chart that has a component (such as an axis) selected.

myChart.Deselect


DisplayBlanksAs Property

Returns or sets the way that blank cells are plotted on a chart. Can be one of the following XlDisplayBlanksAs constants: xlNotPlotted, xlInterpolated, or xlZero. Read/write Long.


DisplayBlanksAs Property Example

This example sets Microsoft Graph to not plot blank cells.

myChart.DisplayBlanksAs = xlNotPlotted


DisplayEquation Property

True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels. Read/write Boolean.


DisplayEquation Property Example

This example displays the R-squared value and equation for trendline one. The example should be run on a 2-D column chart that has a trendline for the first series.

With myChart.SeriesCollection(1).Trendlines(1)

.DisplayRSquared = True

.DisplayEquation = True

End With


DisplayRSquared Property

True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels. Read/write Boolean.


DisplayRSquared Property Example

This example displays the R-squared value and equation for trendline one. The example should be run on a 2-D column chart that has a trendline for the first series.

With myChart.SeriesCollection(1).Trendlines(1)

.DisplayRSquared = True

.DisplayEquation = True

End With


DoughnutGroups Method

On a 2-D chart, returns an object that represents either a single doughnut chart group (a ChartGroup object, Syntax 1) or a collection of the doughnut chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.DoughnutGroups(Index)

Syntax 2

expression.DoughnutGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. Specifies the chart group.


DoughnutGroups Method Example

This example sets the starting angle for doughnut group one.

myChart.DoughnutGroups(1).FirstSliceAngle = 45


DoughnutHoleSize Property

Returns or sets the size of the hole in a doughnut chart group. The hole size is expressed as a percentage of the chart size, between 10 and 90 percent. Read/write Long.


DoughnutHoleSize Property Example

This example sets the hole size for doughnut group one. The example should be run on a 2-D doughnut chart.

myChart.DoughnutGroups(1).DoughnutHoleSize = 10


DownBars Property

Returns a DownBars object that represents the down bars on a line chart. Applies only to line charts. Read-only.


DownBars Property Example

This example turns on up bars and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart that has two series that cross each other at one or more data points.

With myChart.ChartGroups(1)

.HasUpDownBars = True

.DownBars.Interior.ColorIndex = 3

.UpBars.Interior.ColorIndex = 5

End With


DropLines Property

Returns a DropLines object that represents the drop lines for a series on a line chart or area chart. Applies only to line charts or area charts. Read-only.


DropLines Property Example

This example turns on drop lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

With myChart.ChartGroups(1)

.HasDropLines = True

With .DropLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


Elevation Property

Returns or sets the elevation of the 3-D chart view, in degrees. Read/write Long.

Remarks

The chart elevation is the height at which you view the chart, in degrees. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.


Elevation Property Example

This example sets the chart elevation to 34 degrees. The example should be run on a 3-D chart (the Elevation property fails on 2-D charts).

myChart.Elevation = 34


EndStyle Property

Returns or sets the end style for the error bars. Can be one of the following XlEndStyleCap constants: xlCap or xlNoCap. Read/write Long.


EndStyle Property Example

This example sets the end style for the error bars for series one. The example should be run on a 2-D line chart that has Y error bars for the first series.

myChart.SeriesCollection(1).ErrorBars.EndStyle = xlCap


ErrorBar Method

Applies error bars to the specified series.

Syntax

expression.ErrorBar(Direction, Include, Type, Amount, MinusValues)

expression   Required. An expression that returns a Series object.

Direction   Optional Variant. The error bar direction. Can be one of the following XlErrorBarDirection constants: xlX or xlY. xlX can only be used with scatter charts.The default value is xlY.

Include   Optional Variant. The error bar parts to be included. Can be one of the following XlErrorBarInclude constants: xlErrorBarIncludePlusValues, xlErrorBarIncludeMinusValues, xlErrorBarIncludeNone, or xlErrorBarIncludeBoth. The default value is xlErrorBarIncludeBoth.

Type   Optional Variant. The error bar type. Can be one of the following XlErrorBarType constants: xlErrorBarTypeFixedValue, xlErrorBarTypePercent, xlErrorBarTypeStDev, xlErrorBarTypeStError, or xlErrorBarTypeCustom.

Amount   Optional Variant. The error amount. Used for only the positive error amount when Type is xlErrorBarTypeCustom.

MinusValues   Optional Variant. The negative error amount when Type is xlErrorBarTypeCustom.


ErrorBar Method Example

This example applies standard error bars in the Y direction for series one. The error bars are applied in the positive and negative directions. The example should be run on a 2-D line chart.

myChart.SeriesCollection(1).ErrorBar _

Direction:=xlY, Include:=xlErrorBarIncludeBoth, _

Type:=xlErrorBarTypeStError


ErrorBars Property

Returns an ErrorBars object that represents the error bars for the series. Read-only.


ErrorBars Property Example

This example sets the error bar color for series one. The example should be run on a 2-D line chart that has error bars for series one.

With myChart.SeriesCollection(1)

.ErrorBars.Border.ColorIndex = 8

End With


Explosion Property

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/write Long.


Explosion Property Example

This example sets the explosion value for point two. The example should be run on a pie chart.

myChart.SeriesCollection(1).Points(2).Explosion = 20


Export Method

Exports the chart in a graphic format.

Syntax

expression.Export(FileName, FilterName, Interactive)

expression   Required. An expression that returns a Chart object.

FileName   Required String. The name of the exported file.

FilterName   Optional Variant. The language-independent name of the graphic filter as it appears in the registry.

Interactive   Optional Variant. True to display the dialog box that contains the filter-specific options. If this argument is False, Microsoft Graph uses the default values for the filter. The default value is False.


Export Method Example

This example exports the chart as a GIF file.

myChart.Export _

FileName:="current_sales.gif", FilterName:="GIF"


FirstSliceAngle Property

Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Read/write Long.


FirstSliceAngle Property Example

This example sets the angle for the first slice in chart group one. The example should be run on a 2-D pie chart.

myChart.ChartGroups(1).FirstSliceAngle = 15


Floor Property

Returns a Floor object that represents the floor of the 3-D chart. Read-only.


Floor Property Example

This example sets the floor color to blue. The example should be run on a 3-D chart (the Floor property fails on 2-D charts).

myChart.Floor.Interior.ColorIndex = 5


Font Property

Returns a Font object that represents the font of the specified object. Read-only.


Font Property Example

This example sets the font in the chart title to 14-point bold italic.

With myChart.ChartTitle.Font

.Size = 14

.Bold = True

.Italic = True

End With


FontStyle Property

Returns or sets the font style. Read/write String.

Remarks

Changing this property may affect other Font properties (such as Bold and Italic).


FontStyle Property Example

This example sets the font style for the chart title to bold and italic.

myChart.ChartTitle.Font.FontStyle = "Bold Italic"


ForeColor Property

Returns a ChartColorFormat object that represents the fill foreground color.


ForeColor Property Example

This example sets the gradient, background color, and foreground color for the chart area fill.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


Forward Property

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Long.


Forward Property Example

This example sets the number of units that the trendline extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

With myChart.SeriesCollection(1).Trendlines(1)

.Forward = 5

.Backward = .5

End With


GapDepth Property

Returns or sets the distance between the data series on a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500. Read/write Long.


GapDepth Property Example

This example sets the distance between the data series to 200 percent of the marker width. The example should be run on a 3-D chart (the GapDepth property fails on 2-D charts).

myChart.GapDepth = 200


GapWidth Property

Bar and Column charts: Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500. Read/write Long.

Pie of Pie and Bar of Pie charts: Returns or sets the space between the primary and secondary sections of the specified chart. The value of this property must be between 5 and 200. Read/write Long.


GapWidth Property Example

This example sets the space between column clusters to be 50 percent of the column width.

myChart.ChartGroups(1).GapWidth = 50


Has3DEffect Property

True if the series has a three-dimensional appearance. Applies only to bubble charts. Read/write Boolean.


Has3DEffect Property Example

This example gives series one on the bubble chart a three-dimensional appearance.

With myChart

.SeriesCollection(1).Has3DEffect = True

End With


Has3DShading Property

True if the chart group has three-dimensional shading. Read/write Boolean.


Has3DShading Property Example

This example adds three-dimensional shading to chart group one on the chart.

Charts(1).ChartGroups(1).Has3DShading = True


HasAxis Property

Returns or sets which axes exist on the chart. Read/write Variant.

Syntax

expression.HasAxis(Index1, Index2)

expression   Required. An expression that returns a Chart object.

Index1   Optional Variant. The axis type. Can be one of the following XlAxisType constants: xlCategory, xlValue, or xlSeriesAxis. Series axes apply only to 3-D charts.

Index2   Optional Variant. The axis group. Can be either of the following XlAxisGroup constants: xlPrimary or xlSecondary. 3-D charts have only one set of axes.

Remarks

Microsoft Graph may create or delete axes if you change the chart type or change the AxisGroup property.


HasAxis Property Example

This example turns on the primary value axis.

myChart.HasAxis(xlValue, xlPrimary) = True


HasBorderHorizontal Property

True if the chart data table has horizontal cell borders. Read/write Boolean.


HasBorderHorizontal Property Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

With myChart

    .HasDataTable = True

    With .DataTable

        .HasBorderHorizontal = False

        .HasBorderVertical = False

        .HasBorderOutline = True

    End With

End With


HasBorderOutline Property

True if the chart data table has outline borders. Read/write Boolean.


HasBorderOutline Property Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

With myChart

    .HasDataTable = True

    With .DataTable

        .HasBorderHorizontal = False

        .HasBorderVertical = False

        .HasBorderOutline = True

    End With

End With


HasBorderVertical Property

True if the chart data table has vertical cell borders. Read/write Boolean.


HasBorderVertical Property Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

With myChart

    .HasDataTable = True

    With .DataTable

        .HasBorderHorizontal = False

        .HasBorderVertical = False

        .HasBorderOutline = True

    End With

End With


HasDataLabel Property

True if the point has a data label. Read/write Boolean.


HasDataLabel Property Example

This example turns on the data label for point seven in series three, and then it sets the data label color to blue.

With myChart.SeriesCollection(3).Points(7)

.HasDataLabel = True

.ApplyDataLabels type:=xlValue

.DataLabel.Font.ColorIndex = 5

End With


HasDataLabels Property

True if the series has data labels. Read/write Boolean.


HasDataLabels Property Example

This example turns on data labels for series three.

With myChart.SeriesCollection(3)

.HasDataLabels = True

.ApplyDataLabels type:=xlValue

End With


HasDataTable Property

True if the chart has a data table. Read/write Boolean.


HasDataTable Property Example

This example causes the chart data table to be displayed with an outline border and no cell borders.

With myChart

    .HasDataTable = True

    With .DataTable

        .HasBorderHorizontal = False

        .HasBorderVertical = False

        .HasBorderOutline = True

    End With

End With


HasDropLines Property

True if the line chart or area chart has drop lines. Applies only to line and area charts. Read/write Boolean.


HasDropLines Property Example

This example turns on drop lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has one series.

With myChart.ChartGroups(1)

.HasDropLines = True

With .DropLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


HasErrorBars Property

True if the series has error bars. This property isn't available for 3-D charts. Read/write Boolean.


HasErrorBars Property Example

This example removes error bars from series one. The example should be run on a 2-D line chart that has error bars for series one.

myChart.SeriesCollection(1).HasErrorBars = False


HasHiLoLines Property

True if the line chart has high-low lines. Applies only to line charts. Read/write Boolean.


HasHiLoLines Property Example

This example turns on high-low lines for chart group one and then sets line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

With myChart.ChartGroups(1)

.HasHiLoLines = True

With .HiLoLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


HasLeaderLines Property

True if the series has leader lines. Read/write Boolean.


HasLeaderLines Property Example

This example adds data labels and blue leader lines to series one on the pie chart.

With myChart.SeriesCollection(1)

.HasDataLabels = True

.DataLabels.Position = xlLabelPositionBestFit

.HasLeaderLines = True

.LeaderLines.Border.ColorIndex = 5

End With


HasLegend Property

True if the chart has a legend. Read/write Boolean.


HasLegend Property Example

This example turns on the legend for the chart and then sets the legend font color to blue.

With myChart

.HasLegend = True

.Legend.Font.ColorIndex = 5

End With


HasMajorGridlines Property

True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.


HasMajorGridlines Property Example

This example sets the color of the major gridlines for the value axis.

With myChart.Axes(xlValue)

If .HasMajorGridlines Then

.MajorGridlines.Border.ColorIndex = 3	'set color to red

End If

End With


HasMinorGridlines Property

True if the axis has minor gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.


HasMinorGridlines Property Example

This example sets the color of the minor gridlines for the value axis.

With myChart.Axes(xlValue)

If .HasMinorGridlines Then

.MinorGridlines.Border.ColorIndex = 4	'set color to green

End If

End With


HasRadarAxisLabels Property

True if a radar chart has axis labels. Applies only to radar charts. Read/write Boolean.


HasRadarAxisLabels Property Example

This example turns on radar axis labels for chart group one and sets their color. The example should be run on a radar chart.

With myChart.ChartGroups(1)

.HasRadarAxisLabels = True

.RadarAxisLabels.Font.ColorIndex = 3

End With


HasSeriesLines Property

True if a stacked column chart or bar chart has series lines or if a Pie of Pie chart or Bar of Pie chart has connector lines between the two sections. Applies only to stacked column charts, bar charts, Pie of Pie charts, or Bar of Pie charts. Read/write Boolean.


HasSeriesLines Property Example

This example turns on series lines for chart group one and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

With myChart.ChartGroups(1)

.HasSeriesLines = True

With .SeriesLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


HasTitle Property

True if the axis or chart has a visible title. Read/write Boolean.

Remarks

An axis title is represented by an AxisTitle object.

A chart title is represented by a ChartTitle object.


HasTitle Property Example

This example adds an axis label to the category axis.

With myChart.Axes(xlCategory)

.HasTitle = True

.AxisTitle.Text = "July Sales"

End With


HasUpDownBars Property

True if the specified line chart has up and down bars. Applies only to line charts. Read/write Boolean


HasUpDownBars Property Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

With myChart.ChartGroups(1)

.HasUpDownBars = True

.DownBars.Interior.ColorIndex = 3

.UpBars.Interior.ColorIndex = 5

End With


Height Property

Returns or sets the height of an object, in points. Read/write Long, except as shown in the following table.

Remarks

The meaning of the Height property depends on the specified object.

Object type	Height
Application	The height of the main application window. On the Macintosh, this is always equal to the total height of the screen, in points. Setting this value to something else on the Macintosh will have no effect. In Windows, if the window is minimized, this property is read-only and refers to the height of the icon. If the window is maximized, this property cannot be set. Use the WindowState property to determine the window state.
Axis, LegendEntry, LegendKey	The height of the object. Read-only.
ChartArea, Chart, DataSheet, Legend, PlotArea	The height of the object.


Height Property Example

This example sets the height of the chart legend to 1 inch (72 points).

myChart.Legend.Height = 72


HeightPercent Property

Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). Read/write Long.


HeightPercent Property Example

This example sets the height of the chart to 80 percent of its width. The example should be run on a 3-D chart.

myChart.HeightPercent = 80


HorizontalAlignment Property

Returns or sets the horizontal alignment for the object. For all objects, this can be one of the following XlHAlign constants: xlHAlignCenter, xlHAlignDistributed, xlHAlignJustify, xlHAlignLeft, or xlHAlignRight. Read/write Long.

Remarks

The xlHAlignDistributed alignment style works only in Far East versions of Microsoft Graph.


HorizontalAlignment Property Example

This example centers the chart title.

myChart.ChartTitle.HorizontalAlignment = xlCenter


Index Property

Returns the index number of the object within the collection of similar objects. Read-only Long.


Index Property Example

This example displays the index number of an object passed to this procedure.

MsgBox "The index number of this object is " & obj.Index


Insert Method

Inserts a cell or a range of cells into the datasheet and shifts other cells away to make space.

expression.Insert(Shift)

expression   Required. An expression that returns a Range object.

Shift   Optional Variant. Specifies which way to shift the cells. Can be one of the following XlInsertShiftDirection constants: xlShiftToRight or xlShiftDown. If this argument is omitted, Microsoft Graph decides based on the shape of the range.


Insert Method Example

This example inserts a new row before row four on the datasheet.

myChart.Application.DataSheet.Rows(4).Insert

This example inserts new cells at the range A1:C5 on the datasheet and shifts cells downward.

Set mySheet = myChart.Application.DataSheet

mySheet.Range("A1:C5").Insert shift:=xlShiftDown


Intercept Property

Returns or sets the point where the trendline crosses the value axis. Read/write Double.

Remarks

Setting this property sets the InterceptIsAuto property to False.


Intercept Property Example

This example sets trendline one to cross the value axis at 5. The example should be run on a 2-D column chart that contains a single series with a trendline.

myChart.SeriesCollection(1).Trendlines(1).Intercept = 5


InterceptIsAuto Property

True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.

Remarks

Setting the Intercept property sets this property to False.


InterceptIsAuto Property Example

This example sets Microsoft Graph to automatically determine the trendline intercept point. The example should be run on a 2-D column chart that contains a single series with a trendline.

myChart.SeriesCollection(1).Trendlines(1) _

.InterceptIsAuto = True


Interior Property

Returns an Interior object that represents the interior of the specified object. Read-only.


Interior Property Example

This example sets the interior color of the chart title.

myChart.ChartTitle.Interior.ColorIndex = 8


InvertIfNegative Property

True if Microsoft Graph inverts the pattern in the item when it corresponds to a negative number. Read/write Variant for the Interior object; read/write Boolean for all other objects.


InvertIfNegative Property Example

This example inverts the pattern for negative values in series one. The example should be run on a 2-D column chart.

myChart.SeriesCollection(1).InvertIfNegative = True


Italic Property

True if the font style is italic. Read/write Boolean.


Italic Property Example

This example sets the font style to italic for the chart title.

myChart.ChartTitle.Font.Italic = True


Left Property

Returns or sets the position of the specified object, in points Read/write Long, except as shown in the following table.

Remarks

The meaning of the Left property depends on the specified object.

Object	Meaning
Application	The distance from the left edge of the screen to the left edge of the main Microsoft Graph window.
Chart, DataSheet	The distance from the left edge of the object to the left edge of the Microsoft Graph window.
Axis, LegendEntry, LegendKey	The distance from the left edge of the object to the left edge of the chart area. Read-only.
AxisTitle, ChartArea, ChartTitle, DataLabel, Legend, PlotArea	The distance from the left edge of the object to the left edge of the chart area.
If the window is maximized, Application.Left returns a negative number that varies based on the width of the window border. Setting Application.Left to 0 (zero) will make the window a tiny bit smaller than it would be if the application window were maximized. In other words, if Application.Left is 0 (zero), the left border of the main Microsoft Graph window will just barely be visible on the screen.

On the Macintosh, Application.Left is always 0 (zero). Setting this value to something else on the Macintosh will have no effect.

In Windows, if the Microsoft Graph window is minimized, Application.Left controls the position of the window icon.


Left Property Example

This example aligns the left edge of the chart title with the left edge of the chart area.

myChart.ChartTitle.Left = 0


LegendEntries Method

Returns an object that represents either a single legend entry (a LegendEntry object, Syntax 1) or a collection of legend entries (a LegendEntries object, Syntax 2) for the legend.

Syntax 1

expression.LegendEntries(Index)

Syntax 2

expression.LegendEntries

expression   Required. An expression that returns a Legend object.

Index   Optional Variant. The number of the legend entry.


LegendEntries Method Example

This example sets the font for legend entry one.

myChart.Legend.LegendEntries(1).Font.Name = "Arial"


LegendKey Property

Returns a LegendKey object that represents the legend key associated with the entry.


LegendKey Property Example

This example sets the legend key for legend entry one to be a triangle. The example should be run on a 2-D line chart.

myChart.Legend.LegendEntries(1).LegendKey _

.MarkerStyle = xlMarkerStyleTriangle


Line3DGroup Property

Returns a ChartGroup object that represents the line chart group on a 3-D chart. Read-only.


Line3DGroup Property Example

This example sets the 3-D line group to use a different color for each data marker.

myChart.Line3DGroup.VaryByCategories = True


LineGroups Method

On a 2-D chart, returns an object that represents either a single line chart group (a ChartGroup object, Syntax 1) or a collection of the line chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.LineGroups(Index)

Syntax 2

expression.LineGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. Specifies the chart group.


LineGroups Method Example

This example sets line group one to use a different color for each data marker. The example should be run on a 2-D chart.

myChart.LineGroups(1).VaryByCategories = True


LineStyle Property

Returns or sets the line style for the border. Can be one of the following XlLineStyle constants: xlContinuous, xlDash, xlDashDot, xlDashDotDot, xlDot, xlDouble, xlSlantDashDot, or xlLineStyleNone. Read/write Long.


LineStyle Property Example

This example puts a border around the chart area and the plot area.

With myChart

.ChartArea.Border.LineStyle = xlDasDot

With .PlotArea.Border

.LineStyle = xlDashDotDot

.Weight = xlThick

End With

End With


MajorTickMark Property

Returns or sets the type of major tick mark for the specified axis. Can be one of the following XlTickMark constants: xlTickMarkNone, xlTickMarkInside, xlTickMarkOutside, or xlTickMarkCross. Read/write Long.


MajorTickMark Property Example

This example sets the major tick marks for the value axis to be outside the axis.

myChart.Axes(xlValue).MajorTickMark = xlTickMarkOutside


MajorUnit Property

Returns or sets the major units for the axis. Read/write Double.

Remarks

Setting this property sets the MajorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick-mark spacing on the category axis.


MajorUnit Property Example

This example sets the major and minor units for the value axis.

With myChart.Axes(xlValue)

.MajorUnit = 100

.MinorUnit = 20

End With


MajorUnitIsAuto Property

True if Microsoft Graph calculates the major units for the axis. Read/write Boolean.

Remarks

Setting the MajorUnit property sets this property to False.


MajorUnitIsAuto Property Example

This example automatically sets the major and minor units for the value axis.

With myChart.Axes(xlValue)

.MajorUnitIsAuto = True

.MinorUnitIsAuto = True

End With


MajorUnitScale Property

Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Can be one of the following XlTimeUnit constants: xlDays, xlMonths, or xlYears. Read/write Long.


MajorUnitScale Property Example

This example sets the category axis to use a time scale and sets the major and minor units.

With myChart.Axes(xlCategory)

    .CategoryType = xlTimeScale

    .MajorUnit = 5

    .MajorUnitScale = xlDays

    .MinorUnit = 1

    .MinorUnitScale = xlDays

End With


MarkerBackgroundColor Property

Returns or sets the marker background color as an RGB value. Applies only to line, scatter, and radar charts. Read/write Long


MarkerBackgroundColor Property Example

This example sets the marker background and foreground colors for the second point in series one.

With myChart.SeriesCollection(1).Points(2)

.MarkerBackgroundColor = RGB(0,255,0)	' green

.MarkerForegroundColor = RGB(255,0,0)	' red

End With


MarkerBackgroundColorIndex Property

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Remarks

The following illustration shows the color-index values in the default color palette.


MarkerBackgroundColorIndex Property Example

This example sets the marker background and foreground colors for the second point in series one.

With myChart.SeriesCollection(1).Points(2)

.MarkerBackgroundColorIndex = 4	'green

.MarkerForegroundColorIndex = 3	'red

End With


MarkerForegroundColor Property

Returns or sets the foreground color of the marker as an RGB value. Applies only to line, scatter, and radar charts. Read/write Long.


MarkerForegroundColor Property Example

This example sets the marker background and foreground colors for the second point in series one.

With myChart.SeriesCollection(1).Points(2)

.MarkerBackgroundColor = RGB(0,255,0)	' green

.MarkerForegroundColor = RGB(255,0,0)	' red

End With


MarkerForegroundColorIndex Property

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Applies only to line, scatter, and radar charts. Read/write Long.

Remarks

The following illustration shows the color-index values in the default color palette.


MarkerForegroundColorIndex Property Example

This example sets the marker background and foreground colors for the second point in series one.

With myChart.SeriesCollection(1).Points(2)

.MarkerBackgroundColorIndex = 4	'green

.MarkerForegroundColorIndex = 3	'red

End With


MarkerSize Property

Returns or sets the data-marker size, in points. Read/write Long.


MarkerSize Property Example

This example sets the data-marker size for all data markers in series one.

MyChart.SeriesCollection(1).MarkerSize = 10


MarkerStyle Property

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write Long.

Can be one of the following XlMarkerStyle constants.

Constant	Description
xlMarkerStyleNone	No markers
xlMarkerStyleAutomatic	Automatic markers
xlMarkerStyleSquare	Square markers
xlMarkerStyleDiamond	Diamond-shaped markers
xlMarkerStyleTriangle	Triangular markers
xlMarkerStyleX	Square markers with an X
xlMarkerStyleStar	Square markers with an asterisk
xlMarkerStyleDot	Short bar markers
xlMarkerStyleDash	Long bar markers
xlMarkerStyleCircle	Circular markers
xlMarkerStylePlus	Square markers with a plus sign
xlMarkerStylePicture	Picture markers


MarkerStyle Property Example

This example sets the marker style for series one. The example should be run on a 2-D line chart.

myChart.SeriesCollection(1).MarkerStyle = xlMarkerStyleCircle


MaximumScale Property

Returns or sets the maximum value on the axis. Read/write Double.

Remarks

Setting this property sets the MaximumScaleIsAuto property to False.


MaximumScale Property Example

This example sets the minimum and maximum values for the value axis.

With myChart.Axes(xlValue)

.MinimumScale = 10

.MaximumScale = 120

End With


MaximumScaleIsAuto Property

True if Microsoft Graph calculates the maximum value for the axis. Read/write Boolean.

Remarks

Setting the MaximumScale property sets this property to False.


MaximumScaleIsAuto Property Example

This example automatically calculates the minimum scale and the maximum scale for the value axis.

With myChart.Axes(xlValue)

.MinimumScaleIsAuto = True

.MaximumScaleIsAuto = True

End With


MinimumScale Property

Returns or sets the minimum value on the axis. Read/write Double.

Remarks

Setting this property sets the MinimumScaleIsAuto property to False.


MinimumScale Property Example

This example sets the minimum and maximum values for the value axis.

With myChart.Axes(xlValue)

.MinimumScale = 10

.MaximumScale = 120

End With


MinimumScaleIsAuto Property

True if Microsoft Graph calculates the minimum value for the axis. Read/write Boolean.

Remarks

Setting the MinimumScale property sets this property to False.


MinimumScaleIsAuto Property Example

This example automatically calculates the minimum scale and the maximum scale for the value axis.

With myChart.Axes(xlValue)

.MinimumScaleIsAuto = True

.MaximumScaleIsAuto = True

End With


MinorTickMark Property

Returns or sets the type of minor tick mark for the specified axis. Can be one of the following XlTickMark constants: xlTickMarkNone, xlTickMarkInside, xlTickMarkOutside, or xlTickMarkCross. Read/write Long.


MinorTickMark Property Example

This example sets the minor tick marks for the value axis to be inside the axis.

myChart.Axes(xlValue).MinorTickMark = xlTickMarkInside


MinorUnit Property

Returns or sets the minor units on the axis. Read/write Double.

Remarks

Setting this property sets the MinorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick-mark spacing on the category axis.


MinorUnit Property Example

This example sets the major and minor units for the value axis.

With myChart.Axes(xlValue)

.MajorUnit = 100

.MinorUnit = 20

End With


MinorUnitIsAuto Property

True if Microsoft Graph calculates minor units for the axis. Read/write Boolean.

Remarks

Setting the MinorUnit property sets this property to False.


MinorUnitIsAuto Property Example

This example automatically calculates major and minor units for the value axis.

With myChart.Axes(xlValue)

.MajorUnitIsAuto = True

.MinorUnitIsAuto = True

End With


MinorUnitScale Property

Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Can be one of the following XlTimeUnit constants: xlDays, xlMonths, or xlYears. Read/write Long.


MinorUnitScale Property Example

This example sets the category axis to use a time scale and sets the major and minor units.

With myChart.Axes(xlCategory)

    .CategoryType = xlTimeScale

    .MajorUnit = 5

    .MajorUnitScale = xlDays

    .MinorUnit = 1

    .MinorUnitScale = xlDays

End With


MoveAfterReturn Property

True if the active cell will be moved as soon as the ENTER (RETURN) key is pressed. Read/write Boolean.


MoveAfterReturn Property Example

This example sets the MoveAfterReturn property to True.

myChart.Application.MoveAfterReturn = True


Name Property

Returns or sets the name of the object.  Read/write String.


Name Property Example

This example assigns the name of the first trendline to the variable myTrendname.

myTrendname = myChart.SeriesCollection(1).Trendlines(1).Name


NameIsAuto Property

True if Microsoft Graph automatically determines the name of the trendline. Read/write Boolean.


NameIsAuto Property Example

This example sets Microsoft Graph to automatically determine the name for trendline one. The example should be run on a 2-D column chart that contains a single series with a trendline.

myChart.SeriesCollection(1).Trendlines(1).NameIsAuto = True


NumberFormat Property

Returns or sets the format code for the object. Returns Null if the cells in the specified range don't all have the same number format. Read/write Variant for the Range object; read/write String for all other objects.


NumberFormat Property Example

This example sets the number format property for the data labels for series one.

myChart.SeriesCollection(1).DataLabels.NumberFormat = "General"


Order Property

Returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial. Read/write Long.


Order Property Example

This example sets the order of the first trendline for series one if it's polynomial.

With myChart.SeriesCollection(1).Trendlines(1)

If .Type = xlPolynomial Then .Order = 3

End With


Orientation Property

Returns or sets the object's orientation, as shown in the following table. Read/write Long.

Object	Orientation
AxisTitle, ChartTitle, DataLabel, Range, Style, TextFrame	The text orientation. Can be an integer value from  – 90 to 90 degrees or one of the following XlOrientation constants: xlDownward, xlHorizontal, xlUpward, or xlVertical.
TickLabels	The text orientation. Can be an integer value from  – 90 to 90 degrees or one of the following XlTickLabelOrientation constants: xlTickLabelOrientationAutomatic, xlTickLabelOrientationDownward, xlTickLabelOrientationHorizontal, xlTickLabelOrientationUpward, or xlTickLabelOrientationVertical.


Orientation Property Example

This example sets the orientation for the chart title.

myChart.ChartTitle.Orientation = xlHorizontal


OutlineFont Property

True if the font is an outline font. Read/write Boolean.

Remarks

This property has no effect in Windows, but its value is retained (it can be set and returned).


OutlineFont Property Example

This example sets the font for the chart title to an outline font.

myChart.ChartTitle.Font.OutlineFont = True


Overlap Property

Specifies how bars and columns are positioned. Can be a value between  – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/write Long.

Remarks

If this property is set to  – 100, bars are positioned so that there's one bar width between them. If the overlap is 0 (zero), there's no space between bars (one bar starts immediately after the preceding bar). If the overlap is 100, bars are positioned on top of each other.


Overlap Property Example

This example sets the overlap for chart group one to  – 50. The example should be run on a 2-D column chart that has two or more series.

myChart.ChartGroups(1).Overlap = -50


Parent Property

Returns the parent object for the specified object. Read-only.


Pattern Property

Interior object: Returns or sets the interior pattern. Read/write Long.

Can be one of the following XlPattern constants:

xlPatternAutomatic xlPatternChecker xlPatternCrissCross xlPatternDown xlPatternGray16 xlPatternGray25 xlPatternGray50 xlPatternGray75 xlPatternGray8 xlPatternGrid	xlPatternHorizontal xlPatternLightDown xlPatternLightHorizontal xlPatternLightUp xlPatternLightVertical xlPatternNone xlPatternSemiGray75 xlPatternSolid xlPatternUp xlPatternVertical
ChartFillFormat object: Returns or sets the fill pattern. Read-only Long.

Can be one of the following MsoPatternType constants:

msoPattern10Percent msoPattern20Percent msoPattern25Percent msoPattern30Percent msoPattern40Percent msoPattern50Percent msoPattern5Percent msoPattern60Percent msoPattern70Percent msoPattern75Percent msoPattern80Percent msoPattern90Percent msoPatternDarkDownwardDiagonal msoPatternDarkHorizontal msoPatternDarkUpwardDiagonal msoPatternDarkVertical msoPatternDashedDownwardDiagonal msoPatternDashedHorizontal msoPatternDashedUpwardDiagonal msoPatternDashedVertical msoPatternDiagonalBrick msoPatternDivits msoPatternDottedGrid msoPatternHorizontalBrick msoPatternLargeCheckerBoard	msoPatternLargeConfetti msoPatternLargeGrid msoPatternLightDiamonds msoPatternLightDownwardDiagonal msoPatternLightHorizontal msoPatternLightUpwardDiagonal msoPatternLightVertical msoPatternMixed msoPatternNarrowHorizontal msoPatternNarrowVertical msoPatternOutlinedDiamonds msoPatternPlaid msoPatternShingles msoPatternSmallCheckerBoard msoPatternSmallConfetti msoPatternSmallGrid msoPatternSolidDiamonds msoPatternSpheres msoPatternTrellis msoPatternWaves msoPatternWavyLines msoPatternWeave msoPatternWideDownwardDiagonal msoPatternWideUpwardDiagonal


Pattern Property Example

This example adds a crisscross pattern to the interior of the plot area.

myChart.PlotArea.Interior.Pattern = xlPatternCrissCross


PatternColor Property

Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.


PatternColor Property Example

This example sets the color of the interior pattern for the chart area.

myChart.ChartArea.Interior.PatternColor = RGB(255,0,0)


PatternColorIndex Property

Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Remarks

Set this property to xlColorIndexAutomatic to specify the automatic pattern for cells or the automatic fill style for drawing objects. Set this property to xlColorIndexNone to specify that you don't want a pattern (this is the same as setting the Pattern property of the Interior object to xlPatternNone).

The following illustration shows the color-index values in the default color palette.


PatternColorIndex Property Example

This example sets the color of the interior pattern for the chart area.

myChart.ChartArea.Interior.PatternColorIndex = 5


Period Property

Returns or sets the period for the moving-average trendline. Read/write Long.


Period Property Example

This example sets the period for the moving-average trendline. The example should be run on a 2-D column chart with a single series that contains 10 data points and a moving-average trendline.

With myChart.SeriesCollection(1).Trendlines(1)

If .Type = xlMovingAvg Then .Period = 5

End With


Perspective Property

Returns or sets the perspective for the 3-D chart view. Must be from 0 through 100. This property is ignored if the RightAngleAxes property is True. Read/write Long.


Perspective Property Example

This example sets the perspective of Chart1 to 70. The example should be run on a 3-D chart.

myChart.RightAngleAxes = False

myChart.Perspective = 70


PictureType Property

Returns or sets the way pictures are displayed on a column or bar picture chart or on the walls and faces of a 3-D chart. Read/write Variant.

Can be one of the following XlPictureType constants.

Value	Description
xlStretch	Stretches the picture to reach the necessary value.
xlStack	Stacks the pictures to reach the necessary value.
xlScale	Stacks the pictures; use the PictureUnit property to determine what unit each picture represents.
xlTile	Tiles the pictures.


PictureType Property Example

This example sets series one to stretch pictures. The example should be run on a 2-D column chart with picture data markers.

myChart.SeriesCollection(1).PictureType = xlStretch


PictureUnit Property

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlScale (otherwise, this property is ignored). Read/write Long.


PictureUnit Property Example

This example sets series one to stack pictures and uses each picture to represent five units. The example should be run on a 2-D column chart with picture data markers.

With myChart.SeriesCollection(1)

.PictureType = xlScale

.PictureUnit = 5

End With


Pie3DGroup Property

Returns a ChartGroup object that represents the pie chart group on a 3-D chart. Read-only.


Pie3DGroup Property Example

This example sets the 3-D pie group to use a different color for each data marker.

myChart.Pie3DGroup.VaryByCategories = True


PieGroups Method

On a 2-D chart, returns an object that represents either a single pie chart group (a ChartGroup object, Syntax 1) or a collection of the pie chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.PieGroups(Index)

Syntax 2

expression.PieGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. Specifies the chart group.


PieGroups Method Example

This example sets pie group one to use a different color for each data marker. The example should be run on a 2-D chart.

myChart.PieGroups(1).VaryByCategories = True


PlotArea Property

Returns a PlotArea object that represents the plot area of a chart. Read-only.


PlotArea Property Example

This example sets the color of the plot area interior of Chart1 to cyan.

myChart.PlotArea.Interior.ColorIndex = 8


PlotBy Property

Returns or sets the way columns or rows are used as data series on the chart. Can be one of the following XlRowCol constants: xlColumns or xlRows. Read/write Long.


PlotBy Property Example

This example causes the embedded chart to plot data by columns.

myChart.PlotBy = xlColumns


Points Method

Returns an object that represents a single point (a Point object, Syntax 1) or a collection of all the points (a Points object, Syntax 2) in the series. Read-only.

Syntax 1

expression.Points(Index)

Syntax 2

expression.Points

expression   Required. An expression that returns a Series object.

Index   Optional Variant. The name or number of the point.


Points Method Example

This example applies a data label to point one in series one.

myChart.SeriesCollection(1).Points(1).ApplyDataLabels


Position Property

Returns or sets the position of the specified object, as shown in the following table. Read/write Long.

Object	Position
DataLabel, DataLabels	The position of the data label. Can be one of the following XlDataLabelPosition constants: xlLabelPositionAbove, xlLabelPositionBelow, xlLabelPositionBestFit, xlLabelPositionCenter, xlLabelPositionCustom, xlLabelPositionInsideBase, xlLabelPositionInsideEnd, xlLabelPositionLeft, xlLabelPositionMixed, xlLabelPositionOutsideEnd, or xlLabelPositionRight.
Legend	The position of the legend on the chart. Can be one of the following XlLegendPosition constants: xlLegendPositionBottom, xlLegendPositionCorner, xlLegendPositionLeft, xlLegendPositionRight, or xlLegendPositionTop.


Position Property Example

This example sets the position of the legend to the top of the chart.

myChart.Legend.Position = xlLegendPositionTop


Quit Method

Quits Microsoft Graph.

Syntax

expression.Quit

expression   Required. An expression that returns an Application object.


Quit Method Example

This example quits Microsoft Graph.

myChart.Application.Quit


RadarGroups Method

On a 2-D chart, returns an object that represents either a single radar chart group (a ChartGroup object, Syntax 1) or a collection of the radar chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.RadarGroups(Index)

Syntax 2

expression.RadarGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. Specifies the chart group.


RadarGroups Method Example

This example sets radar group one to use a different color for each data marker. The example should be run on a 2-D chart.

myChart.RadarGroups(1).VaryByCategories = True


ReadingOrder Property

This property isn't used in the U.S. English version of Microsoft Graph.


ReplacementList Method

Returns the array of AutoCorrect replacements.

Syntax

expression.ReplacementList(Index)

expression   Required. An expression that returns an AutoCorrect object.

Index   Optional Variant. The row of the array of AutoCorrect replacements to be returned. The row is returned as a one-dimensional array with two elements: The first element is the text in column 1, and the second element is the text in column 2. If Index is out of range, this method fails.

If Index is omitted, this method returns a two-dimensional array. Each row in the array contains one replacement, as shown in the following table.

Column	Contents
1	The text to be replaced
2	The replacement text
Remarks

Use the AddReplacement method to add an entry to the replacement list.


ReplacementList Method Example

This example searches the replacement list for "Temperature" and displays the replacement entry if it exists.

repl = myChart.Application.AutoCorrect.ReplacementList

For x = 1 To UBound(repl)

If repl(x, 1) = "Temperature" Then MsgBox repl(x, 2)

Next


ReplaceText Property

True if text in the list of AutoCorrect replacements is replaced automatically. Read/write Boolean.


ReplaceText Property Example

This example turns off automatic text replacement for the chart.

With myChart.Application.AutoCorrect

.CapitalizeNamesOfDays = True

.ReplaceText = False

End With


ReversePlotOrder Property

True if Microsoft Graph plots data points from last to first. Read/write Boolean.

Remarks

This property cannot be used on radar charts.


ReversePlotOrder Property Example

This example plots data points from last to first on the value axis.

myChart.Axes(xlValue).ReversePlotOrder = True


RightAngleAxes Property

True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts. Read/write Boolean.

Remarks

If this property is True, the Perspective property is ignored.


RightAngleAxes Property Example

This example sets the axes to intersect at right angles. The example should be run on a 3-D chart.

myChart.RightAngleAxes = True


Rotation Property

Chart object: Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees). The value of this property must be from 0 to 360, except for 3-D bar charts, where the value must be from 0 to 44. The default value is 20. Applies only to 3-D charts. Read/write Variant.


Rotation Property Example

This example sets the rotation of Chart1 to 30 degrees. The example should be run on a 3-D chart.

myChart.Rotation = 30


Rows Property

Range object: Returns a Range object that represents the rows in the specified range. Read-only.

Datasheet object: Returns a Range object that represents all the rows on the datasheet. Read-only.

For information about returning a single member of a collection, see Returning an Object from a Collection.


Rows Property Example

This example deletes row three on the datasheet.

myChart.Application.DataSheet.Rows(3).Delete


ScaleType Property

Returns or sets the value axis scale type. Can be one of the following XlScaleType constants: xlScaleLinear or xlScaleLogarithmic. Applies only to the value axis. Read/write Long.

Remarks

A logarithmic scale uses base 10 logarithms.


ScaleType Property Example

This example sets the value axis to use a logarithmic scale.

myChart.Axes(xlValue).ScaleType = xlScaleLogarithmic


SecondaryPlot Property

True if the point is in the secondary section of either a pie of pie chart or a bar of pie chart. Applies only to points on pie of pie charts or bar of pie charts. Read/write Boolean.


SecondaryPlot Property Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example moves point four to the secondary section of the chart.

With myChart.SeriesCollection(1)

.Points(4).SecondaryPlot = True

End With


SecondPlotSize Property

Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 through 200. Read/write Long.


SecondPlotSize Property Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. The secondary section is 50 percent of the size of the primary pie.

With myChart.ChartGroups(1)

.SplitType = xlSplitByValue

.SplitValue = 10

.VaryByCategories = True

.SecondPlotSize = 50

End With


SeriesCollection Method

Returns an object that represents either a single series (a Series object, Syntax 1) or a collection of all the series (a SeriesCollection object, Syntax 2) in the chart or chart group.

Syntax 1

expression.SeriesCollection(Index)

Syntax 2

expression.SeriesCollection

expression   Required. An expression that returns a Chart or ChartGroup object.

Index   Optional Variant. The name or number of the series.


SeriesCollection Method Example

This example turns on data labels for series one.

myChart.SeriesCollection(1).HasDataLabels = True


Shadow Property

True if the font is a shadow font or if the specified object has a shadow. Read/write Boolean.

Remarks

For the Font object, this property has no effect in Microsoft Windows, but its value is retained (it can be set and returned).


Shadow Property Example

This example adds a shadow to the title of Chart1.

myChart.ChartTitle.Shadow = True


ShowChartTipNames Property

True if charts show chart tip names. The default value is True. Read/write Boolean.


ShowChartTipNames Property Example

This example turns off chart tip names and values.

With myChart.Application

.ShowChartTipNames = False

.ShowChartTipValues = False

End With


ShowChartTipValues Property

True if charts show chart tip values. The default value is True. Read/write Boolean.


ShowChartTipValues Property Example

This example turns off chart tip names and values.

With myChart.Application

.ShowChartTipNames = False

.ShowChartTipValues = False

End With


ShowLegendKey Property

True if the data label legend key is visible. Read/write Boolean.


ShowLegendKey Property Example

This example sets the data labels for series one to show values and the legend key.

With myChart.SeriesCollection(1).DataLabels

.ShowLegendKey = True

.Type = xlShowValue

End With


ShowNegativeBubbles Property

True if negative bubbles are shown for the chart group. Valid only for bubble charts. Read/write Boolean.


ShowNegativeBubbles Property Example

This example makes negative bubbles visible for chart group one.

myChart.ChartGroups(1).ShowNegativeBubbles = True


Size Property

Returns or sets the size of the font. Read/write Variant.


Size Property Example

This example sets the font size for the chart title.

myChart.ChartTitle.Font.Size = 12


Smooth Property

True if curve smoothing is turned on for the line chart or scatter chart. Applies only to line and scatter charts. Read/write.


Smooth Property Example

This example turns on curve smoothing for series one. The example should be run on a 2-D line chart.

myChart.SeriesCollection(1).Smooth = True


SplitType Property

Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Can be one of the following XlChartSplitType constants: xlSplitByPosition, xlSplitByPercentValue, xlSplitByCustomSplit, or xlSplitByValue. Read/write Long.


SplitType Property Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

With myChart.ChartGroups(1)

.SplitType = xlSplitByValue

.SplitValue = 10

.VaryByCategories = True

End With


SplitValue Property

Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart. Read/write Variant.


SplitValue Property Example

This example must be run on either a pie of pie chart or a bar of pie chart. The example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section.

With myChart.ChartGroups(1)

.SplitType = xlSplitByValue

.SplitValue = 10

.VaryByCategories = True

End With


Strikethrough Property

True if the font is struck through with a horizontal line. Read/write Boolean.


Strikethrough Property Example

This example sets the font in the chart title to strikethrough.

myChart.ChartTitle.Font.Strikethrough = True


SurfaceGroup Property

Returns a ChartGroup object that represents the surface chart group of a 3-D chart. Read-only.


SurfaceGroup Property Example

This example sets the 3-D surface group to use a different color for each data marker. The example should be run on a 3-D chart.

myChart.SurfaceGroup.VaryByCategories = True


Text Property

Returns or sets the text for the specified object. Read/write String.


Text Property Example

This example sets the text for the title of the chart.

With myChart

.HasTitle = True

.ChartTitle.Text = "First Quarter Sales"

End With

This example sets the axis title text for the category axis.

With myChart.Axes(xlCategory)

.HasTitle = True

.AxisTitle.Text = "Month"

End With


TickLabelPosition Property

Describes the position of tick-mark labels on the specified axis. Can be one of the following XlTickLabelPosition constants: xlTickLabelPositionNone, xlTickLabelPositionLow, xlTickLabelPositionHigh, or xlTickLabelPositionNextToAxis. Read/write Long.


TickLabelPosition Property Example

This example sets tick-mark labels on the category axis to the high position (above the chart).

myChart.Axes(xlCategory) _

.TickLabelPosition = xlTickLabelPositionHigh


TickLabels Property

Returns a TickLabels collection that represents the tick-mark labels for the specified axis. Read-only.


TickLabels Property Example

This example sets the color of the tick-mark label font for the value axis.

myChart.Axes(xlValue).TickLabels.Font.ColorIndex = 3


TickLabelSpacing Property

Returns or sets the number of categories or series between tick-mark labels. Applies only to category and series axes. Read/write Long.

Remarks

Tick-mark label spacing on the value axis is always calculated by Microsoft Graph.


TickLabelSpacing Property Example

This example sets the number of categories between tick-mark labels on the category axis.

myChart.Axes(xlCategory).TickLabelSpacing = 10


TickMarkSpacing Property

Returns or sets the number of categories or series between tick marks. Applies only to category and series axes. Read/write Long.

Remarks

Use the MajorUnit and MinorUnit properties to set tick-mark spacing on the value axis.


TickMarkSpacing Property Example

This example sets the number of categories between tick marks on the category axis.

myChart.Axes(xlCategory).TickMarkSpacing = 10


Top Property

Returns or sets the position of the specified object, in points. Read/write Long, except as shown in the following table.

Remarks

The meaning of the Top property depends on the specified object.

Object	Meaning
Application	The distance from the top edge of the screen to the top edge of the main Microsoft Graph window. In Windows, if the application window is minimized, this property controls the position of the window icon (anywhere on the screen). On the Macintosh, the value is always 0 (zero); setting the value to something else will have no effect.
Axis, AxisTitle, ChartArea, Chart, ChartTitle, DataLabel, DataSheet, Legend, LegendEntry, LegendKey, PlotArea	The distance from the top edge of the object to the top of row 1 (on a datasheet) or the top of the chart area (on a chart). Read-only for Axis, LegendEntry, and LegendKey.


Top Property Example

This example sets the position of the top of the chart title.

myChart.ChartTitle.Top = 10


Trendlines Method

Returns an object that represents a single trendline (a Trendline object, Syntax 1) or a collection of all the trendlines (a Trendlines object, Syntax 2) for the series.

Syntax 1

object.Trendlines(Index)

Syntax 2

object.Trendlines

object   Required. The Series object.

Index   Optional Variant. The name or number of the trendline.


Trendlines Method Example

This example adds a linear trendline to series one.

myChart.SeriesCollection(1).Trendlines.Add Type:=xlLinear


TwoColorGradient Method

Sets the specified fill to a two-color gradient.

Syntax

expression.TwoColorGradient(Style, Variant)

expression   Required. An expression that returns a ChartFillFormat object.

Style   Required Long. Specifies the gradient style. Can be one of the following MsoGradientStyle constants: msoGradientDiagonalDown, msoGradientDiagonalUp, msoGradientFromCenter, msoGradientFromCorner, msoGradientHorizontal, or msoGradientVertical.

Variant   Required Long. Specifies the gradient variant. Can be a value from 1 through 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be either 1 or 2.


TwoColorGradient Method Example

This example sets the gradient, background color, and foreground color for the chart area fill on the chart.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


TwoInitialCapitals Property

True if words that begin with two capital letters are corrected automatically. Read/write Boolean.


TwoInitialCapitals Property Example

This example sets Microsoft Graph to automatically correct words that begin with two capital letters.

With myChart.Application.AutoCorrect

.TwoInitialCapitals = True

.ReplaceText = True

End With


Underline Property

Returns or sets the type of underline applied to the font. Can be one of the following XlUnderlineStyle constants: xlUnderlineStyleNone, xlUnderlineStyleSingle, xlUnderlineStyleDouble, xlUnderlineStyleSingleAccounting, or xlUnderlineStyleDoubleAccounting. Read/write Long.


Underline Property Example

This example sets the font in the chart title to single underline.

myChart.ChartTitle.Font.Underline = xlUnderlineStyleSingle


UpBars Property

Returns an UpBars collection that represents the up bars on a line chart. Applies only to line charts. Read-only.


UpBars Property Example

This example turns on up and down bars for chart group one and then sets their colors. The example should be run on a 2-D line chart containing two series that cross each other at one or more data points.

With myChart.ChartGroups(1)

.HasUpDownBars = True

.DownBars.Interior.ColorIndex = 3

.UpBars.Interior.ColorIndex = 5

End With


Value Property

Returns the value of the specified cell. If the cell is empty, Value returns the value Empty (use the IsEmpty function to test for this case). If the Range object contains more than one cell, this property returns an array of values (use the IsArray function to test for this case). Read/write.


Value Property Example

This example sets the value of cell A1 on the datasheet to 3.14159.

myChart.Application.DataSheet.Range("A1").Value = 3.14159


VaryByCategories Property

True if Microsoft Graph assigns a different color or pattern to each data marker. The chart must contain only one series. Read/write Boolean.


VaryByCategories Property Example

This example assigns a different color or pattern to each data marker in chart group one. The example should be run on a 2-D line chart that has data markers on a series.

myChart.ChartGroups(1).VaryByCategories = True


Version Property

Returns the Microsoft Graph version number. Read-only String.


Version Property Example

This example displays a message box that contains the Microsoft Graph version number and the name of the operating system.

MsgBox "Welcome to Microsoft Graph version " & _

myChart.Application.Version


VerticalAlignment Property

Returns or sets the vertical alignment of the object. Can be one of the following XlVAlign constants: xlVAlignBottom, xlVAlignCenter, xlVAlignDistributed, xlVAlignJustify, or xlVAlignTop. Read/write Long.

Remarks

The xlVAlignDistributed alignment style works only in Far East versions of Microsoft Graph.


VerticalAlignment Property Example

This example sets the vertical alignment of the chart title.

myChart.ChartTitle.VerticalAlignment = xlCenter


Walls Property

Returns a Walls collection that represents the walls of the 3-D chart. Read-only.

Remarks

This property doesn't apply to 3-D pie charts.


Walls Property Example

This example sets the color of the wall border of the chart to red. The example should be run on a 3-D chart.

myChart.Walls.Border.ColorIndex = 3


WallsAndGridlines2D Property

True if gridlines are drawn two-dimensionally on a 3-D chart. Read/write Boolean.


WallsAndGridlines2D Property Example

This example causes Microsoft Graph to draw 2-D gridlines for the chart.

myChart.WallsAndGridlines2D = True


Weight Property

Returns or sets the weight of the border. Can be one of the following XlBorderWeight constants: xlHairline, xlThin, xlMedium, or xlThick. Read/write Long.


Weight Property Example

This example sets the border weight for the chart area.

myChart.ChartArea.Border.Weight = xlMedium


Width Property

Returns or sets an object's width, in points. Read/write Long, except as shown in the following table.

Remarks

The meaning of the Width property depends on the specified object.

Object	Description
Application	The distance from the left edge of the application window to the right edge of the application window.
Axis, LegendEntry, LegendKey	The width of the object. Read-only.
ChartArea, Chart, DataSheet, Legend,  PlotArea	The width of the object.

On the Macintosh, Application.Width is always equal to the total width of the screen, in points. Setting this value to any other value has no effect.

In Windows, if the window is minimized, Application.Width is read-only and returns the width of the window icon.


Width Property Example

This example sets the width of the chart.

myChart.Width = 360


WindowState Property

Returns or sets the state of the window. Can be one of the following XlWindowState constants: xlMaximized, xlMinimized, or xlNormal. Read/write Long.


WindowState Property Example

This example maximizes the application window in Microsoft Graph for Windows. (This property cannot be set on the Macintosh.)

myChart.Application.WindowState = xlMaximized


XYGroups Method

On a 2-D chart, returns an object that represents either a single scatter chart group (a ChartGroup object, Syntax 1) or a collection of the scatter chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.XYGroups(Index)

Syntax 2

expression.XYGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. Specifies the chart group.


XYGroups Method Example

This example sets X-Y group (scatter group) one to use a different color for each data marker. The example should be run on a 2-D chart.

myChart.XYGroups(1).VaryByCategories = True


AutoFit Method

Changes the width of the columns in the specified range to achieve the best fit.

Syntax

expression.AutoFit

expression   Required. An expression that returns a Range object. Must be a row or a range of rows, or a column or a range of columns. Otherwise, this method causes an error.

Remarks

One unit of column width is equal to the width of one character in the Normal style.


AutoFit Method Example

This example changes the width of columns A through I on the datasheet to achieve the best fit.

myChart.Application.DataSheet.Columns("A:I").AutoFit

This example changes the width of columns A through E on the datasheet to achieve the best fit, based only on the contents of cells A1:E1.

myChart.Application.DataSheet.Range("A1:E1").Columns.AutoFit


Cells Property

Range object: Returns a Range object that represents the cells in the specified range. Read-only.

DataSheet object: Returns a Range object that represents all the cells on the datasheet (not just the cells that are currently in use). Read-only.


Cells Property Example

This example clears the formula in cell A1 on the datasheet. Note that on the datasheet, column A is the second column and row 1 is the second row.

myChart.Application.DataSheet.Cells(2,2).ClearContents

This example loops through cells A1:I3 on the datasheet. If any of these cells contains a value less than 0.001, the example replaces that value with 0 (zero).

Set mySheet = myChart.Application.DataSheet

For rwIndex = 2 to 4

    For colIndex = 2 to 10

        If mySheet.Cells(rwIndex, colIndex) < .001 Then

            mySheet.Cells(rwIndex, colIndex).Value = 0

        End If

    Next colIndex

Next rwIndex


DisplayAlerts Property

True if Microsoft Graph displays certain alerts and messages while a macro is running. Read/write Boolean.

Remarks

The default value is True. Set this property to False if you don't want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Graph chooses the default response.

If you set this property to False, Microsoft Graph doesn't automatically set it back to True when your macro stops running. Write your macro such that it always sets this property back to True when it stops running.


Evaluate Method

Converts a Microsoft Graph name to an object or a value.

Syntax

expression.Evaluate(Name)

expression   Required. An expression that returns a Microsoft Graph Application object.

Name   Required String. The name of the specified object, using the Microsoft Graph naming convention.

Remarks

You can use the following types of names in Microsoft Graph with this method:

•	A1-style references. You can use any reference to a single cell in A1-style notation. All references are considered to be absolute references.

•	Ranges. You can use the range, intersect, and union operators (colon, space, and comma, respectively) with references.

•	Defined names. You can specify any name in the language of the macro.

Note   Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument. For example, the following expressions are equivalent:

myChart.Application.[a1].Value = 25

myChart.Application.Evaluate("A1").Value = 25

The advantage of using square brackets is that the code is shorter. The advantage of using Evaluate is that the argument is a string, so you can either construct the string in your code or use a Visual Basic variable.


Evaluate Method Example

This example clears cell A1 on the datasheet.

clearCell = "A1"

myChart.Application.Evaluate(clearCell).Clear


GradientColorType Property

Returns the gradient color type for the specified fill. Can be one of the following MsoGradientColorType constants: msoGradientColorMixed, msoGradientOneColor, msoGradientPresetColors, or msoGradientTwoColors. Read-only Long.


GradientColorType Property Example

This example sets the fill format for the chart if its chart area has a one-color gradient fill.

With myChart.ChartArea.Fill

    If .Type = msoFillGradient Then

        If .GradientColorType = msoGradientOneColor Then

            .OneColorGradient Style := msoGradientFromCorner, _

          	Variant := 1, Degree := 0.3

        End If

    End If

End With


GradientDegree Property

Returns the gradient degree of the specified one-color shaded fill as a floating-point value from 0.0 (dark) through 1.0 (light). Read-only Single.

This property is read-only. Use the OneColorGradient method to set the gradient degree for the fill.


GradientDegree Property Example

This example sets the chart's fill format so that its gradient degree is at least 0.3.

With myChart.ChartArea.Fill

    If .Type = msoFillGradient Then

       If .GradientColorType = msoGradientOneColor Then

           If .GradientDegree < 0.3 Then

              .OneColorGradient .GradientStyle, .GradientVariant, 0.3

           End If

        End If

    End If

End With


GradientStyle Property

Returns the gradient style for the specified fill. Can be one of the following MsoGradientStyle constants: msoGradientDiagonalDown, msoGradientDiagonalUp, msoGradientFromCenter, msoGradientFromCorner, msoGradientFromTitle, msoGradientHorizontal, msoGradientMixed, or msoGradientVertical. Read-only Long.

This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient style for the fill.


GradientStyle Property Example

This example sets the chart's fill format so that its gradient style is changed to msoGradientDiagonalUp if it was originally msoGradientDiagonalDown.

With myChart.ChartArea.Fill

   If .Type = msoFillGradient Then

      If .GradientColorType = msoGradientOneColor Then

         If .GradientStyle = msoGradientDiagonalDown Then

            .OneColorGradient msoGradientDiagonalUp, _

            .GradientVariant, .GradientDegree

         End If

      End If

   End If

End With


GradientVariant Property

Returns the shade variant for the specified fill as an integer value from 1 through 4. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) listed on the Gradient tab in the Fill Effects dialog box. Read-only Long.

This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient variant for the fill.


GradientVariant Property Example

This example sets the chart's fill format so that it's displayed using the second shade variant if it's currently using the first shade variant.

With myChart.ChartArea.Fill

    If .Type = msoFillGradient Then

        If .GradientColorType = msoGradientOneColor Then

            If .GradientVariant = 1 Then

                .OneColorGradient .GradientStyle, 2, _

                .GradientDegree

            End If

        End If

    End If

End With


OneColorGradient Method

Sets the specified fill to a one-color gradient.

Syntax

expression.OneColorGradient(Style, Variant, Degree)

expression   Required. An expression that returns a ChartFillFormat object.

Style   Required Long. The gradient style for the specified fill. Can be one of the following MsoGradientStyle constants: msoGradientDiagonalDown, msoGradientDiagonalUp, msoGradientFromCenter, msoGradientFromCorner, msoGradientHorizontal, or msoGradientVertical.

Variant   Required Long. The gradient variant for the specified fill. Can be a value from 1 through 4, corresponding to the four variants listed on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.

Degree   Required Single. The gradient degree for the specified fill. Can be a value from 0.0 (dark) through 1.0 (light).


OneColorGradient Method Example

This example sets the chart's fill format.

With myChart.ChartArea.Fill

    If .Type = msoFillGradient Then

        If .GradientColorType = msoGradientOneColor Then

            .OneColorGradient Style:=msoGradientFromCorner, _

             Variant:=1, Degree:=0.3

        End If

    End If

End With


Paste Method

Pastes the contents of the Clipboard into the specified range on the datasheet.

Syntax

expression.Paste(Link)

expression   Required. An expression that returns a Range object.

Link   Optional Variant. True to establish a link to the source of the pasted data. The default value is False.


Paste Method Example

This example pastes the contents of the Clipboard into cell A1 on the datasheet.

myChart.Application.DataSheet.Range("A1").Paste


PresetGradient Method

Sets the specified fill to a preset gradient.

Syntax

expression.PresetGradient(Style, Variant, PresetGradientType)

expression   Required. An expression that returns a ChartFillFormat object.

Style   Required Long. The gradient style for the specified fill. Can be one of the following MsoGradientStyle constants: msoGradientDiagonalDown, msoGradientDiagonalUp, msoGradientFromCenter, msoGradientFromCorner, msoGradientHorizontal, or msoGradientVertical.

Variant   Required Long. The gradient variant for the specified fill. Can be a value from 1 through 4, corresponding to the four variants listed on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.

PresetGradientType   Required Long. The gradient type for the specified fill. Can be one of the following MsoPresetGradientType constants: msoGradientBrass, msoGradientChrome, msoGradientDaybreak, msoGradientEarlySunset, msoGradientFire, msoGradientFog, msoGradientGold, msoGradientLateSunset, msoGradientMahogany, msoGradientMoss, msoGradientNightfall, msoGradientOcean, msoGradientParchment, msoGradientRainbow, msoGradientSapphire, or msoGradientSilver.


PresetGradient Method Example

This example sets the chart's fill format to the preset brass color.

With myChart.ChartArea.Fill

    .Visible = True

    .PresetGradient msoGradientDiagonalDown, 3, msoGradientBrass

End With


PresetGradientType Property

Returns the preset gradient type for the specified fill. Can be one of the following MsoPresetGradientType constants: msoGradientBrass, msoGradientChrome, msoGradientDaybreak, msoGradientEarlySunset, msoGradientFire, msoGradientFog, msoGradientGold, msoGradientLateSunset, msoGradientMahogany, msoGradientMoss, msoGradientNightfall, msoGradientOcean, msoGradientParchment, msoGradientRainbow, msoGradientSapphire, or msoGradientSilver. Read-only Long.

This property is read-only. Use the PresetGradient method to set the preset gradient type for the fill.


PresetGradientType Property Example

This example changes the chart's preset gradient fill format from silver to gold.

With myChart.ChartArea.Fill

    If .Type = msoFillGradient Then

        If .GradientColorType = msoGradientPresetColors Then

            If .PresetGradientType = msoGradientSilver Then

                .PresetGradient .GradientStyle, _

                .GradientVariant, msoGradientGold

            End If

        End If

    End If

End With


PresetTexture Property

Returns the preset texture for the specified fill. Can be one of the following MsoPresetTexture constants: msoPresetTextureMixed, msoTextureBrownMarble, msoTextureCloth, msoTextureCork, msoTextureGranite, msoTextureGreenMarble, msoTextureMediumWood, msoTextureOak, msoTexturePaper, msoTextureSand, msoTextureWalnut, msoTextureWhiteMarble, or msoTextureWovenMat. Read-only Long.

This property is read-only. Use the PresetTextured method to set the preset texture for the fill.


PresetTexture Property Example

This example changes the chart's textured fill format from oak to walnut.

With myChart.ChartArea.Fill

    If .Type = msoFillTextured Then

        If .TextureType = msoTexturePreset Then

            If .PresetTexture = msoTextureOak Then

                .PresetTextured msoTextureWalnut

            End If

        End If

    End If

End With


PresetTextured Method

Sets the format of the specified fill to a preset texture.

Syntax

expression.PresetTextured(PresetTexture)

expression   An expression that returns a ChartFillFormat object.

PresetTexture   Required Long. The preset texture for the specified fill. Can be one of the following MsoPresetTexture constants: msoPresetTextureMixed, msoTextureBrownMarble, msoTextureCloth, msoTextureCork, msoTextureGranite, msoTextureGreenMarble, msoTextureMediumWood, msoTextureOak, msoTexturePaper, msoTextureSand, msoTextureWalnut, msoTextureWhiteMarble, or msoTextureWovenMat.


PresetTextured Method Example

This example changes the chart's textured fill format from oak to walnut.

With myChart.ChartArea.Fill

    If .Type = msoFillTextured Then

        If .TextureType = msoTexturePreset Then

            If .PresetTexture = msoTextureOak Then

                .PresetTextured msoTextureWalnut

            End If

        End If

    End If

End With


Subscript Property

True if the specified font is formatted as subscript. The default value is False. Read/write Variant.


Superscript Property

True if the specified font is formatted as superscript. The default value is False. Read/write Variant.


TextureName Property

Returns the name of the custom texture file for the specified fill. Read-only String.

This property is read-only. Use the UserPicture or UserTextured method to set the texture file for the fill.


TextureName Property Example

This example changes the user-defined texture type for the chart's fill format.

With myChart.ChartArea.Fill

    If .Type = msoFillTextured Then

        If .TextureType = msoTextureUserDefined Then

            If .TextureName = "brick.bmp" Then

               .UserTextured "stone.bmp"

            End If

        End If

    End If

End With


TextureType Property

Returns the texture type for the specified fill. Can be one of the following MsoTextureType constants: msoTexturePreset, msoTextureTypeMixed, or msoTextureUserDefined. Read-only Long.

This property is read-only. Use the UserTextured method to set the texture type for the fill.


TextureType Property Example

This example changes the user-defined texture type for the chart's fill format.

With myChart.ChartArea.Fill

    If .Type = msoFillTextured Then

        If .TextureType = msoTextureUserDefined Then

            If .TextureName = "C:\brick.bmp" Then

               .UserTextured "C:\stone.bmp"

            End If

        End If

    End If

End With


Visible Property

True if the specified object is visible. Read/write Boolean or Long.


Visible Property Example

This example formats the chart's fill with a preset gradient and then makes the fill visible.

With myChart.ChartArea.Fill

    .Visible = True

    .PresetGradient msoGradientDiagonalDown, _

     3, msoGradientBrass

End With


Add Method

Creates a new trendline. Returns a Trendline object.

Syntax

expression.Add(Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

expression   Required. An expression that returns a Trendlines object.

Type   Optional Variant. The trendline type. Can be one of the following XlTrendlineType constants: xlLinear, xlLogarithmic, xlExponential, xlPolynomial, xlMovingAvg, or xlPower. The default value is xlLinear.

Order   Optional Variant. Required if Type is xlPolynomial. The trendline order. Must be an integer from 2 through 6.

Period   Optional Variant. Required if Type is xlMovingAvg. The trendline period. Must be an integer greater than 1 and less than the number of data points in the series you're adding a trendline to.

Forward   Optional Variant. The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward   Optional Variant. The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept   Optional Variant. The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.

DisplayEquation   Optional Variant. True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default value is False.

DisplayRSquared   Optional Variant. True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default value is False.

Name   Optional Variant. The name of the trendline, as text. If this argument is omitted, Microsoft Graph generates a name.


Add Method Example

This example creates a new linear trendline on the chart.

myChart.SeriesCollection(1).Trendlines.Add


Area3DGroup Property

Returns a ChartGroup object that represents the specified area chart group on a 3-D chart. Read-only.


Area3DGroup Property Example

This example turns on drop lines for the 3-D area chart group.

myChart.Area3DGroup.HasDropLines = True


AreaGroups Method

On a 2-D chart, this method returns an object that represents either a single area chart group (a ChartGroup object, Syntax 1) or a collection of all the area chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.AreaGroups(Index)

Syntax 2

expression.AreaGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. The index number of the specified chart group.


AreaGroups Method Example

This example turns on drop lines for the 2-D area chart group.

myChart.AreaGroups(1).HasDropLines = True


Bar3DGroup Property

Returns a ChartGroup object that represents the specified bar chart group on a 3-D chart. Read-only.


Bar3DGroup Property Example

This example sets the space between bar clusters in the 3-D bar chart group to be 50 percent of the bar width.

myChart.BarGroup3DGroup.GapWidth = 50


BarGroups Method

On a 2-D chart, this method returns an object that represents either a single bar chart group (a ChartGroup object, Syntax 1) or a collection of all the bar chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.BarGroups(Index)

Syntax 2

expression.BarGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. The index number of the specified bar chart group.


BarGroups Method Example

This example sets the space between bar clusters in the 2-D bar chart group to be 50 percent of the bar width.

myChart.BarGroups(1).GapWidth = 50


Column3DGroup Property

Returns a ChartGroup object that represents the specified column chart group on a 3-D chart. Read-only.


Column3DGroup Property Example

This example sets the space between column clusters in the 3-D column chart group to be 50 percent of the column width.

myChart.Column3DGroup.GapWidth = 50


ColumnGroups Method

On a 2-D chart, returns an object that represents either a single column chart group (a ChartGroup object, Syntax 1) or a collection of the column chart groups (a ChartGroups collection, Syntax 2).

Syntax 1

expression.ColumnGroups(Index)

Syntax 2

expression.ColumnGroups

expression   Required. An expression that returns a Chart object.

Index   Optional Variant. The index number of the specified column chart group.


ColumnGroups Method Example

This example sets the space between column clusters in the 2-D column chart group to be 50 percent of the column width.

myChart.ColumnGroups(1).GapWidth = 50


Corners Property

Returns a Corners object that represents the corners of the specified 3-D chart. Read-only.


DeleteReplacement Method

Deletes an entry from the array of AutoCorrect replacements.

Syntax

expression.DeleteReplacement(What)

expression   Required. An expression that returns an AutoCorrect object.

What   Required String. The text to be replaced, as it appears in the row to be deleted from the array of AutoCorrect replacements. If this string doesn't exist in the array of AutoCorrect replacements, this method fails.


DeleteReplacement Method Example

This example removes the word "Temperature" from the array of AutoCorrect replacements.

With myChart.Application.AutoCorrect

.DeleteReplacement "Temperature"

End With


InsideHeight Property

Returns the inside height of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Height property for the plot area uses the bounding rectangle that includes the axis labels.


InsideLeft Property

Returns the distance from the chart edge to the inside left edge of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Left property for the plot area uses the bounding rectangle that includes the axis labels.


InsideTop Property

Returns the distance from the chart edge to the inside top edge of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Top property for the plot area uses the bounding rectangle that includes the axis labels.


InsideWidth Property

Returns the inside width of the plot area, in points. Read-only Double.

Remarks

The plot area used for this measurement doesn't include the axis labels. The Width property for the plot area uses the bounding rectangle that includes the axis labels.


Patterned Method

Sets a pattern for the specified fill.

Syntax

expression.Patterned(Pattern)

expression   Required. An expression that returns a ChartFillFormat object.

Pattern   Required Long. The pattern type. Can be one of the following MsoPatternType constants:

msoPattern10Percent msoPattern20Percent msoPattern25Percent msoPattern30Percent msoPattern40Percent msoPattern50Percent msoPattern5Percent msoPattern60Percent msoPattern70Percent msoPattern75Percent msoPattern80Percent msoPattern90Percent msoPatternDarkDownwardDiagonal msoPatternDarkHorizontal msoPatternDarkUpwardDiagonal msoPatternDarkVertical msoPatternDashedDownwardDiagonal msoPatternDashedHorizontal msoPatternDashedUpwardDiagonal msoPatternDashedVertical msoPatternDiagonalBricks msoPatternDivits msoPatternDottedGrid msoPatternHorizontalBrick msoPatternLargeCheckerBoard	msoPatternLargeConfetti msoPatternLargeGrid msoPatternLightDiamonds msoPatternLightDownwardDiagonal msoPatternLightHorizontal msoPatternLightUpwardDiagonal msoPatternLightVertical msoPatternMixed msoPatternNarrowHorizontal msoPatternNarrowVertical msoPatternOutlinedDiamonds msoPatternPlaid msoPatternShingles msoPatternSmallCheckerBoard msoPatternSmallConfetti msoPatternSmallGrid msoPatternSolidDiamonds msoPatternSpheres msoPatternTrellis msoPatternWaves msoPatternWavyLines msoPatternWeave msoPatternWideDownwardDiagonal msoPatternWideUpwardDiagonal


Patterned Method Example

This example sets the fill pattern.

With myChart.ChartArea.Fill

.Patterned msoPatternDiagonalBrick

.Visible = True

End With


SetDefaultChart Method

Specifies the name of the chart template that Microsoft Graph will use when creating new charts.

Syntax

expression.SetDefaultChart(FormatName)

expression   Required. An expression that returns an Application object.

FormatName    Optional Variant. The name of the specified custom autoformat. This name can be a string that denotes the custom autoformat, or it can be the special constant xlBuiltIn to specify the built-in chart template.


SetDefaultChart Method Example

This example sets the default chart template to the custom autoformat named "Monthly Sales."

myChart.Application.SetDefaultChart FormatName:="Monthly Sales"


SizeRepresents Property

Returns or sets what the bubble size represents on a bubble chart. Can be either of the following XlSizeRepresents constants: xlSizeIsArea or xlSizeIsWidth. Read/write Long.


SizeRepresents Property Example

This example sets what the bubble size represents for the chart. (The example assumes that the chart is a bubble chart.)

myChart.ChartGroups(1).SizeRepresents = xlSizeIsWidth


UserPicture Method

Fills the specified shape with an image.

Syntax

expression.UserPicture(PictureFile, PictureFormat, PictureStackUnit, PicturePlacement)

expression   An expression that returns a ChartFillFormat object.

PictureFile   Required String. The name of the specified picture file.

PictureFormat   Optional Long. The format of the specified picture. Can be one of the following XlChartPictureType constants: xlScale, xlStackScale, xlStack, or xlStretch.

PictureStackUnit   Optional Long. The stack or scale unit for the specified picture (depends on the PictureFormat argument).

PicturePlacement   Optional Long. The placement of the specified picture. Can be one of the following XlChartPicturePlacement constants: xlSides, xlEnd, xlEndSides, xlFront, xlFrontSides, xlFrontEnd, or xlAllFaces.


UserPicture Method Example

This example sets the chart's fill format so that it's based on a user-supplied picture.

With myChart.ChartArea.Fill

    .UserPicture PictureFile:="C:\My Documents\brick.bmp"

    .Visible = True

End With


UserTextured Method

Fills the specified shape with small tiles of an image. If you want to fill the shape with one large image, use the UserPicture method.

Syntax

expression.UserTextured(TextureFile)

expression   Required. An expression that returns a ChartFillFormat object.

TextureFile   Required String. The name of the specified picture file.


UserTextured Method Example

This example changes the user-defined texture type for the chart's fill format.

With myChart.ChartArea.Fill

    If .Type = msoFillTextured Then

        If .TextureType = msoTextureUserDefined Then

            If .TextureName = "C:\brick.bmp" Then

               .UserTextured "C:\stone.bmp"

            End If

        End If

    End If

End With


DataSheet Property

Returns the DataSheet object. Read-only.


DataSheet Property Example

This example sets the value of cell A1 on the datasheet to 3.14159.

With myChart.Application

    .DataSheet.Range("A1").Value = 3.14159

End With


HasLinks Property

True if the specified chart has links to an external data source. Read-only Boolean.


HasLinks Property Example

This example clears cells A1:D4 on the datasheet if the chart has no links.

With myChart.Application

    If .HasLinks = False Then

        .DataSheet.Range("A1:D4").Clear

    End If

End With


Include Property

True if the data in the specified row or column is included in the chart. Read/write Boolean.


Include Property Example

This example causes the data in the second row on the datasheet to be excluded from the chart.

With myChart.Application.DataSheet

    .Rows(2).Include = False

End With


Range Property

Returns a Range object that represents the specified cell or range of cells.

Syntax 1

expression.Range(Cell1)

Syntax 2

expression.Range(Cell1, Cell2)

expression   Required. An expression that returns a DataSheet object.

Cell1   Required for Syntax 1. The name of the specified range. This must be an A1-style reference in the language the macro is written in. It can include the range operator (a colon), the intersection operator (a space), or the union operator (a comma). It can also include dollar signs, but they're ignored.

Cell1, Cell2   Required for Syntax 2. The cells in the upper-left and lower-right corners of the specified range. Each argument can be a Range object that contains a single cell (or an entire column or entire row), or the argument can be a string that names a single cell in the language the macro is written in.

Remarks

On the datasheet, the first column heading (starting on the left) is A, followed by B, C, D, and so on. The first row heading (starting at the top) is 1, followed by 2, 3, 4, and so on. Neither the leftmost column nor the top row has a heading. In other words, column A is actually the second column from the left; likewise, row 1 is the second row from the top. The leftmost column and the top row, which are commonly used for legend text or axis labels, are referred to as column 0 (zero) and row 0 (zero). Thus, the following example inserts the text "Annual Sales" in the top cell in column A (the second column).

myChart.Application.DataSheet.Range("A0").Value = "Annual Sales"

And the following example inserts the text "District 1" in the leftmost cell in row 2 (the third row).

myChart.Application.DataSheet.Range("02").Value = "District 1"


Range Property Example

This example sets the value of cell A1 on the datasheet to 3.14159.

myChart.DataSheet.Range("A1").Value = 3.14159

This example loops on cells A1:C3 on the datasheet. If one of the cells has a value less than 0.001, the example replaces that value with 0 (zero).

With myChart.Application.DataSheet

    For Each c in .Range("A1:C3")

        If c.Value < .001 Then

            c.Value = 0

        End If

    Next c

End With


Chart Method

Returns a Chart object that represents the Microsoft Graph chart.


FileImport Method

Imports a specified file or range, or an entire sheet of data.

Syntax

expression.FileImport(FileName, Password, ImportRange, WorksheetName, OverwriteCells)

expression   Required. An expression that returns an Application object.

FileName   Required String. The file that contains the data to be imported.

Password  Optional Variant. The password for the file to be imported, if the file is password protected.

ImportRange  Optional Variant. The range of cells to be imported, if the file to be imported is a Microsoft Excel worksheet or workbook. If this argument is omitted, the complete contents of the worksheet are imported.

WorksheetName  Optional Variant. The name of the worksheet to be imported, if the file to be imported is a Microsoft Excel workbook.

OverwriteCells  Optional Variant. True to specify that the user be notified before imported data overwrites existing data on the specified datasheet. The default value ist True.


FileImport Method Example

This example imports data from the range A2:D5 on the worksheet named "MySheet" in the Microsoft Excel workbook named "mynums.xls."

With myChart.Application

    .FileImport FileName:="C:\mynums.xls" _

        ImportRange:="A2:D5" WorksheetName:="MySheet" _

        OverwriteCells:=False

End With


Item Property

Returns a Range object that represents a range that's offset from the specified range. Read-only.

Syntax 1

expression.Item(RowIndex, ColumnIndex)

Syntax 2

expression.Item(RowIndex)

expression   Required. An expression that returns a Range object.

RowIndex   Syntax 1: Required Variant. The row number of the cell you want to work with (the first row in the range is 1).

Syntax 2: Required Variant. The index number of the cell you want to work with, counting from left to right and from top to bottom. Range.Item(1) returns the cell in the upper-left corner of the range; Range.Item(2) returns the cell immediately to the right of this cell.

ColumnIndex   Optional Variant. A number or string that indicates the column number of the cell you want to work with (the first column in the range is either 1 or A).

Remarks

Syntax 1 uses a row number and either a column number or a letter as index arguments. For more information about this syntax, see the Range object.The RowIndex and ColumnIndex arguments are relative offsets. In other words, specifying 1 for RowIndex returns cells in the first row in the range, not the first row on the datasheet.


Item Property Example

This example clears cell B2 on the datasheet.

myChart.Application.DataSheet.Range("A1").Item(2, 2).Clear


Item Method

Returns part of the specified collection. The Item method is the default method for collections. For example, the following two lines of code are equivalent:

myChart.SeriesCollection.Item(1)

myChart.SeriesCollection(1)


SaveAsOldFileFormat Method

In a host application such as Microsoft Powerpoint, saves a chart in the specified older file format.

Syntax

expression.FileImport(MajorVersion, MinorVersion)

expression   Required. An expression that returns an Application object.

MajorVersion   Optional Variant. Specifies the major version number of the file format you want to use.

MinorVersion   Optional Variant. Specifies the minor version number of the file format you want to use.


SaveAsOldFileFormat Example
SaveAsOldFileFormat Method Example

This example saves the chart in Graph5 file format.

myChart.Application.SaveAsOldFileFormat MajorVersion:=5


Update Method

Updates the specified embedded object in the host file.

Syntax

expression.Update

expression   Required. An expression that returns an Application object.


Refresh Method

Causes the specified chart to be redrawn immediately.

Syntax

expression.Refresh

expression   Required. An expression that returns a Chart object.


BarShape Property

Returns or sets the shape used with the specified 3-D bar or column chart. Can be one of the following XlBarShape constants: xlBox, xlConeToMax, xlConeToPoint, xlCylinder, xlPyramidToMax, or xlPyramidToPoint. Read/write Long.


BarShape Property Example

This example sets the shape used with series one on the chart.

myChart.SeriesCollection(1).Barshape = xlConeToPoint


HiLoLines Property

Returns a HiLoLines object that represents the high-low lines for the specified series on a line chart. Applies only to line charts. Read-only.


HiLoLines Property Example

This example turns on high-low lines for chart group one on the chart and then sets their line style, weight, and color. The example should be run on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

With myChart.ChartGroups(1)

.HasHiLoLines = True

With .HiLoLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


LeaderLines Property

Returns a LeaderLines object that represents the leader lines for the specified series. Read-only.


LeaderLines Property Example

This example adds data labels and blue leader lines to series one on the pie chart.

With myChart.SeriesCollection(1)

.HasDataLabels = True

.DataLabels.Position = xlLabelPositionBestFit

.HasLeaderLines = True

.LeaderLines.Border.ColorIndex = 5

End With


Legend Property

Returns a Legend object that represents the legend for the specified chart. Read-only.


Legend Property Example

This example turns on the legend for the chart and then sets the font color for the legend to blue.

myChart.HasLegend = True

myChart.Legend.Font.ColorIndex = 5


MajorGridlines Property

Returns a Gridlines object that represents the major gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.


MajorGridlines Property Example

This example sets the color of the major gridlines for the value axis in the chart.

With myChart.Axes(xlValue)

If .HasMajorGridlines Then

.MajorGridlines.Border.ColorIndex = 5

End If

End With


MinorGridlines Property

Returns a Gridlines object that represents the minor gridlines for the specified axis. Only axes in the primary axis group can have gridlines. Read-only.


MinorGridlines Property Example

This example sets the color of the minor gridlines for the value axis in the chart to blue.

With myChart.Axes(xlValue)

If .HasMinorGridlines Then

.MinorGridlines.Border.ColorIndex = 5

End If

End With


Fill Property

Returns a ChartFillFormat object that contains fill formatting properties for the specified chart. Read-only.


Fill Property Example

This example sets the fill format for the chart to the preset brass color.

With myChart.ChartArea.Fill

    .Visible = True

    .PresetGradient msoGradientDiagonalDown, 3, msoGradientBrass

End With


RGB Property

Returns the red-green-blue value of the specified color. Read-only Long.


RGB Property Example

This example sets the color of the legend font to the foreground fill color of the plot area.

myChart.Legend.Font.Color = _

    myChart.PlotArea.Fill.ForeColor.RGB


SchemeColor Property

Returns or sets the color of the specified ChartColorFormat object as an index in the current color scheme. Read/write Long.


SchemeColor Property Example

This example sets the foreground color, background color, and gradient for the chart area fill on the chart.

With myChart.ChartArea.Fill

.Visible = True

.ForeColor.SchemeColor = 15

.BackColor.SchemeColor = 17

.TwoColorGradient msoGradientHorizontal, 1

End With


SeriesLines Property

Returns a SeriesLines object that represents the series lines for the specified stacked bar chart or stacked column chart. Applies only to stacked bar and stacked column charts. Read-only.


SeriesLines Property Example

This example turns on series lines for chart group one on the chart and then sets their line style, weight, and color. The example should be run on a 2-D stacked column chart that has two or more series.

With myChart.ChartGroups(1)

.HasSeriesLines = True

With .SeriesLines.Border

.LineStyle = xlThin

.Weight = xlMedium

.ColorIndex = 3

End With

End With


RadarAxisLabels Property

Returns a TickLabels object that represents the radar axis labels for the specified chart group. Read-only.


RadarAxisLabels Property Example

This example turns on radar axis labels for chart group one on the chart and then sets the color for the labels. The example should be run on a radar chart.

With myChart.ChartGroups(1)

.HasRadarAxisLabels = True

.RadarAxisLabels.Font.ColorIndex = 3

End With


Solid Method

Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.


Solid Method Example

This example converts the chart area fill to a solid color.

myChart.ChartArea.Fill.Solid


Type Property

Returns or sets the type of the specified object, as shown in the following table.

Object	Type
Axis	Axis type. Can be one of the following XlAxisType constants: xlCategory, xlSeriesAxis, or xlValue. Read/write Long.
ChartColoFormat	Color type. Can be one of the following MsoColorType constants: msoColorTypeMixed, msoColorTypeRGB, or msoColorTypeScheme. Read-only Long.
DataLabel, DataLabels	Data label type. Can be one of the following XlDataLabelsType constants: xlDataLabelsShowBubbleSizes, xlDataLabelsShowLabel, xlDataLabelsShowLabelAndPercent, xlDataLabelsShowNone, xlDataLabelsShowPercent, or xlDataLabelsShowValue. Read/write Long.
ChartFillFormat	Fill type. Can be one of the following MsoFillType constants: msoFillBackground, msoFillGradient, msoFillMixed, msoFillPatterned, msoFillPicture, msoFillSolid, or msoFillTextured. Read-only Long.
Trendline	Trendline type. Can be one of the following XlTrendlineType constants: xlExponential, xlLinear, xlLogarithmic, xlMovingAvg, xlPolynomial, or xlPower. Read/write Long.


Type Property Example

This example changes the trendline type for the first series in the chart. If the series has no trendline, this example fails.

myChart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg


OLE Programmatic Identifiers (Microsoft Graph)

You use an OLE programmatic identifier (sometimes called a ProgID) to create an Automation object.

To create an Automation object that represents the Microsoft Graph Application object, use "MSGraph.Application.8." To create an Automation object that represents the Microsoft Graph Chart object, use "MSGraph.Chart.8." Using "MSGraph.Application" or "MSGraph.Chart" with no version number creates an object in the most recent version of Microsoft Graph available on the machine where the macro is running.


Returning an Object from a Collection

The Item method returns a single object from a collection. The following example sets the firstEntry variable to a LegendEntry object that represents the first legend entry.

Set firstEntry = myChart.Legend.LegendEntries.Item(1)

The Item method is the default method for most collections, so you can write the same statement more concisely by omitting the Item keyword.

Set firstEntry = myChart.Legend.LegendEntries(1)

For more information about a specific collection, see the Help topic for that collection.


Help Topic Not Available

The Help topic cannot be displayed because Visual Basic for Applications Help cannot be found or was not installed.

To install Visual Basic for Applications Help

1.	Run Microsoft Office 97 Setup, and click Add/Remove.

2.	Click Microsoft Access, Microsoft Excel, Microsoft PowerPoint, or Microsoft Word, and then click Change Option.

3.	Click Help, and then click Change Option.

4.	Make sure that the Help for Visual Basic or Language Reference (Microsoft Access) check box is selected.

5.	Continue with Setup.


Help Topic Not Available

The Help topic cannot be displayed because Microsoft Office Visual Basic Help cannot be found or was not installed.

To install Microsoft Office Visual Basic Help

1.	Run Microsoft Office 97 Setup, and click Add/Remove.

2.	Click Microsoft Access, Microsoft Excel, Microsoft PowerPoint, or Microsoft Word, and then click Change Option.

3.	Click Help, and then click Change Option.

4.	Make sure that the Help for Visual Basic or Language Reference (Microsoft Access) check box is selected.

5.	Continue with Setup.


Microsoft Graph Objects


Microsoft Graph Objects (ChartGroup)


point

A unit of measurement equal to 1/72 inch.