Method 'Left' of object 'DataLabel' failed

S

SysMod

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
 
A

Andy Pope

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
 
S

SysMod

Thanks, Andy
I've noticed the 'rate' question so I'll go back and mark the previous one
too.

BTW my problem with -1.#IND was a data point that was text, not numeric :-(

All the best,
Patrick
 

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