View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Method 'Left' of object 'DataLabel' failed

Hi,

There is a Refresh method.
I tested on a xy-scatter with some +14k points and did not get an error when
updating the chart, refreshing and then moving the trendline data label.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"SysMod" wrote in message
...
So, in this chart I create datalabels and then I want them pushed far left
to
the axis, so I get .left and .top and set .left to 0.

However, sometimes, .left gives me
Err -2147467259 Method 'Left' of object 'DataLabel' failed
and the return value is -1#.IND (ie Not a Number)

Some googling in MS finds a note in SP2 that
"The Trendline.DataLabel.Top and Trendline.DataLabel.Left properties of a
chart return the incorrect values if the chart has not been rendered. "

And in fact if I halt in the debugger, and check the .left, it's OK.
So I tried a retry loop using doevents and application.wait and sometimes
that works once and sometimes not.

So, how do I make sure a chart is rendered?
Is there a repaint method, a .ready property I could test and wait for, or
what?

Little point in MS telling us this can happen "if the chart has not been
rendered" without telling us how we can know when it is.

TIA
Patrick