accessing chart objects via VB

  • Thread starter Thread starter CycleMark
  • Start date Start date
C

CycleMark

How do you discover and edit the attributes of chart
objects on a chart sheet from within the VB editor?

***************************************

Subject: Re: VB editing -- multiple charts on a chart-
page
From: "Jon Peltier" <[email protected]> Sent:
10/26/2003 5:35:29 PM

Actually, the Project Explorer only lists the chart
sheet, not any chart
objects on that sheet. If the chart sheet has a chart,
that chart has
no chart object. Chart objects are the containers that
hold an embedded
chart on its parent sheet.

The object model works like this. Assume you have only
one chart sheet,
so the sheet is ActiveWorkbook.Charts(1). Any chart
objects are
referenced by an index: ActiveWorkbook.Charts
(1).ChartObjects(1),
ActiveWorkbook.Charts(1).ChartObjects(2), etc.

- Jon
 
Mark -

Please reply to the original thread. Splitting it like this is pretty
distracting.

You can type VBA statements in the Immediate window to change attributes:

activechart.SeriesCollection(1).name = "My Series"

or prefix with a question mark to see what they are:

?activechart.SeriesCollection(1).name
My Series

- Jon
 
Back
Top