Extract Chart Titles from graphs

E

Excel Monkey

I am looping through some chars in a workbook. I am trying to extract the
text from the Chart Titles. I cannot seem to get this to work using the
ChartTitle object and its Caption property. What am I doing wrong?


Dim chtobj As ChartObject

For Each chtobj In ActiveSheet.ChartObjects
Debug.Print chtobj.ChartTitle.Caption
Next

Thanks

EM
 
B

Barb Reinhardt

Try this

Sub Test()

Dim chtobj As Excel.ChartObject

For Each chtobj In ActiveSheet.ChartObjects
If chtobj.Chart.HasTitle Then
Debug.Print chtobj.Chart.ChartTitle.Text
End If
Next chtobj
End Sub


HTH,
Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top