ChartObjects Collection Object

Description

A collection of all the ChartObject objects on the specified chart sheet, dialog sheet, or worksheet. Each ChartObject object represents an embedded chart. The ChartObject object acts as a container for a Chart object. Properties and methods for the ChartObject object control the appearance and size of the embedded chart on the sheet.

Accessors

The ChartObjects collection contains all the embedded charts on a single sheet. Use the Add method to create a new empty embedded chart and add it to the collection. Use the ChartWizard method to add data and format the new empty chart. The following example creates a new embedded chart on the worksheet named "Sheet1" and then adds the data from cells A1:A20 as a line chart.


Dim ch As ChartObject
Set ch = Worksheets("sheet1").ChartObjects.Add(100, 30, 400, 250)
ch.Chart.ChartWizard source:=Worksheets("sheet1").Range("a1:a20"), _
    gallery:=xlLine, title:="New Chart"

Use the ChartObjects method with an argument to access a single member of the collection or without an argument to access the entire collection at once. The following example deletes all of the embedded charts on the worksheet named "Sheet1."


Worksheets("sheet1").ChartObjects.Delete

Properties

Application Property, Border Property, Count Property, Creator Property, Enabled Property, Height Property, Interior Property, Left Property, Locked Property, OnAction Property, Parent Property, Placement Property, PrintObject Property, RoundedCorners Property, Shadow Property, Top Property, Visible Property, Width Property, ZOrder Property.

Methods

Add Method (Graphic Objects and Controls), BringToFront Method, Copy Method, CopyPicture Method, Cut Method, Delete Method, Duplicate Method, Group Method, Item Method, Select Method, SendToBack Method.