PlotArea is different between Excel 2003 and Excel 2007

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

All,

I am having difficulty programmatically changing chart parameters. For
instance, I want to modify the PlotArea.Height of one of my charts.
When I resize it manually (i.e. increase the PlotArea by a factor of
three) everything scales just fine. When I try to set <chart>.PlotArea
in VB I get an error message:

Number: 1004
Description: Chart Layout Failed

Any thoughts?

Bill
 
Hi,

Is that VB or did you really mean VBA?
And can you post the code you are using.


Cheers
Andy
 
Hi,

Is that VB or did you really mean VBA?
And can you post the code you are using.

Cheers
Andy

--










- Show quoted text -

Hi Andy,

VBA. Here is some of the code. The stuff in between is too ugly to
post. Basically, the chart is created, populated, and that is it:

......

Set zNewChart = zNewBook.Charts.Add(After:=zNewBook.Sheets(nChartCtr))

.....
add data series
label axes
fill in title
... bunch of other stuff .....


zNewChart.PlotArea.Height = zNewChart.PlotArea.Height - 20 ' this is
the spot where the error message occurs


The other anomaly is that if I put a breakpoint on the above, and then
continue, it does not generate an error. However, the PlotArea.Height
does not really change. Also, when I look at the Height before trying
to change it, it has a value of 473.xxxx. However, when I open the
spreadsheet and check it out, it is clearly not 473 in Height because
the DataTable is taking up around 4/5 of the chart area. In addition
to all of this, if I change Height immediately after instantiating the
chart, then there is no error message. However, the final Height of
the PlotArea is still entirely different than 453 (i.e. it is much
smaller).

Hope that wasn't too confusing,

Bill
 
Hi Bill,

It wasn't confusing ;)
But I am unable to replicate your error. For me adjusting the height of
the plotarea works.

The new chart OM is a little flakey. So you may have some luck by simply
messing with properties in order to get the chart to refresh itself.

If you want you can email me the file offline and I will take a look.

Cheers
Andy
 
There occasionally seem to be problems in 2007 with charts that were created
in an earlier version of Excel.

- Jon
 
There occasionally seem to be problems in 2007 with charts that were created
in an earlier version of Excel.

- Jon

Except that I am creating then from scratch in 2007.

Bill
 
Back
Top