View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Charts are hard / found a BUG in ChartObject behavior

Tip 3:
It's not only the Chart title that can't be accessed when a chartobject
has
no series but also various other things, eg the Legend. These will be
re-applied 'as-was' and readable when a series is re-applied. Not sure why
this is a problem though, if you know there are no series defer accessing
those objects until the chart is known to have at least one series.


A point I neglected to make.

Tip 4:

I can't recreate the problem in xl97 or xl2000, plot resizes without error
as Jon described.


Good, so I'm not crazy.

And now, today's bug.

This is not a particularly a chartobject issue but applies to
drawingobjects
in general. Indeed it is a pain! I think this relates to the fact that
shapes have two names. Workaround might be to loop through shapes. Eg


Answers my question

if shp.type = msoChart then
set objCht = shp.drawingobject


Actually Dave's workaround seems to work:

For Each ChtOb In ActiveSheet.ChartObjects
If ChtOb.Name = strMyNameWithDisallowedCharacters Then
Set chtobTheOneIWant = ChtOb
End If
Next

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______