Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Excel 2007 - Legend.Position

I have the following code that sets the Legend position for a chart object

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next

It stops on the .legend.position line with the error

Run-time error '-217467259 (80004005)':

Method 'Position' of object 'Legend' failed.

But then I can step right through the code without a problem. What gives?

Thanks,
Barb Reinhardt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Excel 2007 - Legend.Position

Excel 2007 seems to have to think a bit when working on charts. Stepping
through gives it plenty of time. Insert DoEvents above the offending line of
code.

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


"Barb Reinhardt" wrote in message
...
I have the following code that sets the Legend position for a chart object

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next

It stops on the .legend.position line with the error

Run-time error '-217467259 (80004005)':

Method 'Position' of object 'Legend' failed.

But then I can step right through the code without a problem. What gives?

Thanks,
Barb Reinhardt




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2007 is Slow

Excel 2007 has to think a bit on everything. If you are automating, you should disable screen updating and calculation until every cell has been entered, then enable calculation, calculate, and make the app visible.



Jon Peltier wrote:

Excel 2007 seems to have to think a bit when working on charts.
19-Sep-08

Excel 2007 seems to have to think a bit when working on charts. Stepping
through gives it plenty of time. Insert DoEvents above the offending line of
code.

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


"Barb Reinhardt" wrote in message
...

Previous Posts In This Thread:

On Thursday, September 18, 2008 10:40 AM
BarbReinhard wrote:

Excel 2007 - Legend.Position
I have the following code that sets the Legend position for a chart object

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next

It stops on the .legend.position line with the error

Run-time error '-217467259 (80004005)':

Method 'Position' of object 'Legend' failed.

But then I can step right through the code without a problem. What gives?

Thanks,
Barb Reinhardt

On Friday, September 19, 2008 9:09 AM
Jon Peltier wrote:

Excel 2007 seems to have to think a bit when working on charts.
Excel 2007 seems to have to think a bit when working on charts. Stepping
through gives it plenty of time. Insert DoEvents above the offending line of
code.

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


"Barb Reinhardt" wrote in message
...


Submitted via EggHeadCafe - Software Developer Portal of Choice
Book Review: C# 4.0 In a Nutshell [O'Reilly]
http://www.eggheadcafe.com/tutorials...c-40-in-a.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Excel 2007 is Slow

Bill Fazakerly wrote:
Excel 2007 has to think a bit on everything. If you are automating, you should disable screen updating and calculation until every cell has been entered, then enable calculation, calculate, and make the app visible.


Excel2007 is very slow on charts. You have to be exceedingly careful to
give it enough time to instantiate objects before referring to them. I
usually see it with axes or legend manipulation after chart creation.

This might be me being superstitious, but it seems to be worse on quad
core systems than on dual core (but CPU speeds are also different).

Essentially what Barb describes is a race condition where the code is OK
in the debugger but will not work at full speed because some object or
other isn't yet initialised when the main thread reaches it. DoEvents or
a humble waste time delay loop will usually make these work. In some
cases you can single step debug on from the notional point of failure
since the object will have had plenty of time to initiallise by then.

You can guess that the Charting code is liberally sprinkled with such
incantations based on its glacial slowness with moderate size datasets.

Regards,
Martin Brown

Jon Peltier wrote:

Excel 2007 seems to have to think a bit when working on charts.
19-Sep-08

Excel 2007 seems to have to think a bit when working on charts. Stepping
through gives it plenty of time. Insert DoEvents above the offending line of
code.

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


"Barb Reinhardt" wrote in message
...

Previous Posts In This Thread:

On Thursday, September 18, 2008 10:40 AM
BarbReinhard wrote:

Excel 2007 - Legend.Position
I have the following code that sets the Legend position for a chart object

For Each objCht In WS.ChartObjects
With objCht.Chart
.Legend.Position = xlLegendPositionBottom
End With
Next

It stops on the .legend.position line with the error

Run-time error '-217467259 (80004005)':

Method 'Position' of object 'Legend' failed.

But then I can step right through the code without a problem. What gives?

Thanks,
Barb Reinhardt

On Friday, September 19, 2008 9:09 AM
Jon Peltier wrote:

Excel 2007 seems to have to think a bit when working on charts.
Excel 2007 seems to have to think a bit when working on charts. Stepping
through gives it plenty of time. Insert DoEvents above the offending line of
code.

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


"Barb Reinhardt" wrote in message
...


Submitted via EggHeadCafe - Software Developer Portal of Choice
Book Review: C# 4.0 In a Nutshell [O'Reilly]
http://www.eggheadcafe.com/tutorials...c-40-in-a.aspx

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
Legend Overlaps Chart in Excel 2007 David Billigmeier Charts and Charting in Excel 5 April 21st 23 10:11 PM
Excel 2007. Is it possible to format Legend Key? jkrons Charts and Charting in Excel 3 October 24th 09 04:15 AM
Excel 2007 Legend Key Problem veronica Charts and Charting in Excel 0 November 30th 07 09:14 PM
Legend in Chart changes position every time I copy the graph AR Excel Discussion (Misc queries) 0 May 16th 07 06:22 AM
Legend box position resetting when reopening file donger Charts and Charting in Excel 0 May 19th 06 08:44 PM


All times are GMT +1. The time now is 05:59 AM.

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

About Us

"It's about Microsoft Excel"