A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

ChartArea.left reporting incorrectly?



 
 
Thread Tools Display Modes
  #1  
Old August 7th, 2009, 01:25 PM posted to microsoft.public.excel.charting
Matt McQueen
external usenet poster
 
Posts: 6
Default ChartArea.left reporting incorrectly?

Folks,

A few moons ago I posted this query:

http://www.pcreview.co.uk/forums/thread-3767566.php

Eric/egun's response allowed me to accomplish what I was after using the code:

..Parent.Left = xLoc - ActiveChart.ChartArea.Left -
ActiveChart.PlotArea.InsideLeft

However I've now run into an issue whereby the activechart.chartarea.left
report is incorrect. After creating 9 plots with .chartarea.left = 3, it then
produces two plots with .chartarea.left = 118. Since my goal is to align my
primary y-axis to the right-hand edge of column B, this poses a problem. The
effective code becomes:

..Parent.Left = 96 - 118 - ActiveChart.PlotArea.InsideLeft

which is less than zero. The chart is still created, just shifted to the far
left of the screen.

Interestingly, if I break the code and step through - voila, no problem!

Anybody seen this one before?

Cheers,

Matt
  #2  
Old August 7th, 2009, 01:32 PM posted to microsoft.public.excel.charting
Matt McQueen
external usenet poster
 
Posts: 6
Default ChartArea.left reporting incorrectly?

I forgot to mention that it's Excel 2003.
  #3  
Old August 8th, 2009, 12:01 AM posted to microsoft.public.excel.charting
Jon Peltier[_2_]
external usenet poster
 
Posts: 386
Default ChartArea.left reporting incorrectly?

"Interestingly, if I break the code and step through - voila, no problem!"

When this happens it often means Excel gets ahead of itself, and really
needs to let Windows do some cleaning up before it executes that statement.

You can make this happen by inserting this line before any command that
works only when stepping through:

DoEvents

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



Matt McQueen wrote:
Folks,

A few moons ago I posted this query:

http://www.pcreview.co.uk/forums/thread-3767566.php

Eric/egun's response allowed me to accomplish what I was after using the code:

.Parent.Left = xLoc - ActiveChart.ChartArea.Left -
ActiveChart.PlotArea.InsideLeft

However I've now run into an issue whereby the activechart.chartarea.left
report is incorrect. After creating 9 plots with .chartarea.left = 3, it then
produces two plots with .chartarea.left = 118. Since my goal is to align my
primary y-axis to the right-hand edge of column B, this poses a problem. The
effective code becomes:

.Parent.Left = 96 - 118 - ActiveChart.PlotArea.InsideLeft

which is less than zero. The chart is still created, just shifted to the far
left of the screen.

Interestingly, if I break the code and step through - voila, no problem!

Anybody seen this one before?

Cheers,

Matt

  #4  
Old August 10th, 2009, 02:47 PM posted to microsoft.public.excel.charting
Matt McQueen
external usenet poster
 
Posts: 6
Default ChartArea.left reporting incorrectly?

Interesting tip Jon, thanks for that. I employed it prior to the With - End
With statement I was using on each successive plot to format and orient it.
Previously it was misalinging the final two plots created... with DoEvents it
only misaligned the last plot. I added a DoEvents immediately after the
realignment as well, and Excel turned ScreenUpdating back on (!). Figured I
was in over my head at that point.

In the end I've hardcoded the numbers since they'll nearly always be
constant. Thanks anyway.

  #5  
Old August 12th, 2009, 12:58 PM posted to microsoft.public.excel.charting
Robert Flanagan
external usenet poster
 
Posts: 22
Default ChartArea.left reporting incorrectly?

Matt, set Application.Screenupdating = True. I have seen a number of times
that Excel must update the chart before a property can be properly obtained.
By stepping through the code, you are in effect allowing the chart to
update, which is why it works when stepping through.

Robert Flanagan
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Matt McQueen" wrote in message
...
Folks,

A few moons ago I posted this query:

http://www.pcreview.co.uk/forums/thread-3767566.php

Eric/egun's response allowed me to accomplish what I was after using the
code:

.Parent.Left = xLoc - ActiveChart.ChartArea.Left -
ActiveChart.PlotArea.InsideLeft

However I've now run into an issue whereby the activechart.chartarea.left
report is incorrect. After creating 9 plots with .chartarea.left = 3, it
then
produces two plots with .chartarea.left = 118. Since my goal is to align
my
primary y-axis to the right-hand edge of column B, this poses a problem.
The
effective code becomes:

.Parent.Left = 96 - 118 - ActiveChart.PlotArea.InsideLeft

which is less than zero. The chart is still created, just shifted to the
far
left of the screen.

Interestingly, if I break the code and step through - voila, no problem!

Anybody seen this one before?

Cheers,

Matt



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:19 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.