Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default List Charts Macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default List Charts Macro

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

Phil Hageman wrote:

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 String
Dim ChtObj As ChartObject
Msg = "Worksheet: " & ActiveSheet.Name & vbCrLf
For Each ChtObj In ActiveSheet.ChartObjects
Msg = Msg & vbCrLf & ChtObj.Name
Next
MsgBox Msg
End Sub


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default List Charts Macro

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" wrote in message
...
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 String
Dim ChtObj As ChartObject
Msg = "Worksheet: " & ActiveSheet.Name & vbCrLf
For Each ChtObj In ActiveSheet.ChartObjects
Msg = Msg & vbCrLf & ChtObj.Name
Next
MsgBox Msg
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default List Charts Macro

Hi Phil,

Hopefully its just a line wrapping problem.

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

Cheers
Andy

Phil Hageman wrote:

Andy, Thanks for your reply. When running the code, I get a Compile error: syntax error on the line:
Msg = Msg & vbCrLf & ChtObj.Name & " " &

Thanks,
Phil


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default List Charts Macro

Thanks, Andy. Works great
Phil
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charts using List Feature DS Excel Discussion (Misc queries) 1 May 13th 09 04:29 AM
Is there a list of names for the various charts... Shevvie Charts and Charting in Excel 2 February 28th 09 10:48 PM
How do I set up charts with a drop-down list? Larisa Excel Discussion (Misc queries) 4 May 8th 08 10:57 PM
Adding titels to charts from a list Henning Charts and Charting in Excel 1 August 25th 06 01:46 PM
List Charts in a Worksheet Phil Hageman[_3_] Excel Programming 2 May 17th 04 04:41 PM


All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"