View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Hageman[_3_] Phil Hageman[_3_] is offline
external usenet poster
 
Posts: 160
Default Sub Run-time error

The following sub is suppose to make a list of all charts
in a worksheet. When running the sub, I get Run-time
error '1004': Unable to get the Caption property of the
ChartTitle class. The line Msg = Msg & vbCrLf... is
highlighted. Can someone help me fix this.

Sub ListCharts()
Dim Msg As String
Dim ChtOb As ChartObject
Msg = ActiveSheet.Name & vbCrLf
For Each ChtOb In ActiveSheet.ChartObjects
Msg = Msg & vbCrLf & ChtOb.Name & " : " &
ChtOb.Chart.ChartTitle.Caption
Next
MsgBox Msg
End Sub