ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract Chart Titles from graphs (https://www.excelbanter.com/excel-programming/427975-extract-chart-titles-graphs.html)

Excel Monkey[_2_]

Extract Chart Titles from graphs
 
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

Barb Reinhardt

Extract Chart Titles from graphs
 
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

"Excel Monkey" wrote:

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



All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com