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

Hiya

I wish to populate a listbox with all the chartobjects
within a workbook.

I am using something like the following

Dim xlChart as ChartObject

For each XlChart in Thisworkbook.Worksheets.ChartObjects

Me.ListBox.AddItem xlChart.Name

Next xlChart

Unfortunately it doesn't recognise the ChartObjects
collection.

Can any see a solution?

Thanks in a advance for any help

Nick Shinkins
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ChartObjects

Hi,
try something like following

Sub charts_names()
Dim i As Integer
Dim xlChart As ChartObject

For i = 1 To ActiveWorkbook.Worksheets.Count
For Each xlChart In Worksheets(i).ChartObjects
MsgBox xlChart.Name
Next xlChart
Next i

End Sub

Jare

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default ChartObjects

I think that ChartObjects only applies to embedded charts i.e. those
whose location is a worksheet and not those that are seperate
chartsheets. You probably need to check for the existence of charts
under both possibilities .


'+++++++++++++++++++++++++++++++++++++++++++++++++ +++++
Dim ws As Worksheet, ch As Chart, chOBJ As ChartObject

' get the names of all the chartsheets
For Each ch In ActiveWorkbook.Charts
Me.ListBox.AddItem ch.Name
Next ch

' get the names of all the embedded
For Each ws In ActiveWorkbook.Worksheets
For Each chOBJ In ws.ChartObjects
Me.ListBox.AddItem chOBJ.Chart.Name
Next chOBJ
Next ws
'+++++++++++++++++++++++++++++++++++++++++++++++++ +++++

----
Sean
"Just press the off switch, and go to sleep!"

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
How to export all chartobjects in a sheet to powerpoint (creating a new ppt file) as pictures? Gunnar Johansson Charts and Charting in Excel 1 May 9th 05 05:10 AM
Not allow selection of chartobjects ? Gunnar Johansson Charts and Charting in Excel 0 May 8th 05 01:40 PM
Marcowarnings when pasting chartobjects to powerpoint Marie J-son Charts and Charting in Excel 2 March 3rd 05 02:54 AM
Change datalabel font size for all chartobjects in a row Marie J-son Charts and Charting in Excel 2 December 5th 04 07:02 PM
Workbook-Events donīt work with ChartObjects geissma Excel Programming 0 September 16th 03 01:09 PM


All times are GMT +1. The time now is 07:44 PM.

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"