List Charts Macro

P

Phil Hageman

This sub creates a message box listing worksheet charts, by chart number. Can the code be modified to show the chart title after the chart name

Sub ListCharts(
Dim Msg As Strin
Dim ChtObj As ChartObjec
Msg = "Worksheet: " & ActiveSheet.Name & vbCrL
For Each ChtObj In ActiveSheet.ChartObject
Msg = Msg & vbCrLf & ChtObj.Nam
Nex
MsgBox Ms
End Sub
 
A

Andy Pope

Hi Phil,

Try this,

Sub ListCharts()
Dim Msg As String
Dim ChtObj As ChartObject
Msg = "Worksheet: " & ActiveSheet.Name & vbCrLf
For Each ChtObj In ActiveSheet.ChartObjects
If ChtObj.Chart.HasTitle Then
Msg = Msg & vbCrLf & ChtObj.Name & " " &
ChtObj.Chart.ChartTitle.Text
Else
Msg = Msg & vbCrLf & ChtObj.Name
End If
Next
MsgBox Msg
End Sub

Cheers
Andy
 
T

Tom Ogilvy

http://support.microsoft.com/?id=177760
VBA: How to Run Macros in Other Office Programs


http://support.microsoft.com/?id=210111
ACC2000: Using Microsoft Access as an Automation Server

http://support.microsoft.com/?id=253338
INFO: Office Developer Samples and Tools Available for Download

http://support.microsoft.com/?id=260410
OFF2000: Microsoft Office 2000 Automation Help File Available

--
Regards,
Tom Ogilvy

Phil Hageman said:
This sub creates a message box listing worksheet charts, by chart number.
Can the code be modified to show the chart title after the chart name?
 
A

Andy Pope

Hi Phil,

Hopefully its just a line wrapping problem.

Msg = Msg & vbCrLf & ChtObj.Name & _
" " & ChtObj.Chart.ChartTitle.Text

Cheers
Andy
 

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