Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sub Run-time error
Sub ListCharts()
Dim Msg As String Dim ChtOb As ChartObject Msg = ActiveSheet.Name & vbCrLf For Each ChtOb In ActiveSheet.ChartObjects if chtOb.HasTitle then Msg = Msg & vbCrLf & ChtOb.Name & " : " & _ ChtOb.Chart.ChartTitle.Caption Else Msg = Msg & vbCrLf & chtOb.Name & ":" & _ "No title" End if Next MsgBox Msg End Sub -- Regards, Tom Ogilvy "Phil Hageman" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable | Excel Worksheet Functions | |||
Receiving run-time error only part of the time | Excel Discussion (Misc queries) | |||
run-time error '91'-Close Button error | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel |