Chart Object Caption
Try the following two options. The first doesn't require
that the chart be selected and assumes that it is a
worksheet based (embedded) chart. It is also assumed that
it is the first chart added to the worksheet (if more than
one). Change the ChartObject index number (in
parenthesis) to suit if necessary.
Also note that the line ".HasTitle = True" is only
necessary if no title already exists. Change to False to
suppress the chart title.
Preferred code:
Sub ChangeChartTitle()
With ActiveSheet.ChartObjects(1).Chart
.HasTitle = True
.ChartTitle.Characters.Text = "Annual Widget Sales"
End With
End Sub
Alternate code:
Sub ChangeChartTitle()
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Annual Widget Sales"
End With
End Sub
Hope it does the job.
Regards,
Greg
-----Original Message-----
I have a control that brings up a graph. The Excel name
for the graph shown
in the caption is "Sheet 1 Chart 109".
My question is how can I give the chart a new caption?
and /or
How can I suppress the caption (for other chart objects
in the workbook)
I have tried ActiveChart.Caption = "NewTitle" but VBA
wouldn't accept this.
Would someone be kind enough to help resolve this.
(I'm very impressed with this News Group - I am learning
new techniques,
almost daily)
TIA
regards
Jeff Smith
.
|