Class ChartObjects (Excel VBA)

A collection of all the ChartObject objects on the specified chart sheet, dialog sheet, or worksheet.

The classes Chart and Worksheet. give access to class ChartObjects


Dim cos as ChartObjects
Set cos = ActiveSheet.ChartObjects()

For Each

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


Dim chro As ChartObject
For Each chro In ActiveSheet.ChartObjects()
	
Next chro

Methods

Add - Creates a new embedded chart.

Copy - Copies the object to the Clipboard.

CopyPicture - Copies the selected object to the Clipboard as a picture.

Cut - Cuts the object to the Clipboard.

Delete - Deletes the object.

Duplicate - Duplicates the chartobject and returns a reference to the new copy.

Item - Returns a single object from a collection.

Select - Selects the object.

Properties

Count returns a Long value that represents the number of objects in the collection.

Height returns or sets a Double value that represents the height, in points, of the object.

Left returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).

Locked returns or sets a Boolean value that indicates if the objects are locked.

Placement returns or sets a Variant value, containing an XlPlacement constant, that represents the way the xlplacements are attached to the cells below them.

PrintObject true if the objects will be printed when the document is printed.

ProtectChartObject true if the embedded chart frame cannot be moved, resized, or deleted through the user interface.

ShapeRange returns a ShapeRange object that represents the specified object or objects.

Top returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).

Visible returns or sets a Boolean value that determines whether the object is visible.

Width returns or sets a Double value that represents the width, in points, of the object.