Hi,
The charttitle, along with the other labelling items in a chart, do not
expose the Width or Height properties.
Try this workaround. (Beware of word wrapping).
'------------------
Sub X
MsgBox GetChartTitleWidth(ActiveChart)
End Sub
Function GetChartTitleWidth(MyChart As Chart) As Single
Dim sngOrigLeft As Single
If MyChart.HasTitle Then
sngOrigLeft = MyChart.ChartTitle.Left
MyChart.ChartTitle.Left = MyChart.ChartArea.Left +
MyChart.ChartArea.Width
GetChartTitleWidth = (MyChart.ChartArea.Width -
MyChart.ChartArea.Left) - MyChart.ChartTitle.Left
MyChart.ChartTitle.Left = sngOrigLeft
End If
End Function
'------------------
It uses the fact that the chart title can not be more beyond the area of
the chart. The routine tries and then uses the gap between the edge and
the new Left position to determine the width. Should be close enough.
Obvioulsy the same technique can be applied to get the height
Chart - Title Widths
Does anyone know how to find the width of a title/axis title?
--
Cheers
Andy
http://www.andypope.info