error in setting chart area width

T

TONY

sThis snipet of code fails in the with black while trying to set .width = 200

sub a()
Set co = ActiveSheet.ChartObjects.Add(cw * 3, rh * 0.5, cw * 8, rh * 20)
' Name it
co.Name = "ChartExample"

With co.Chart.ChartArea
.Width = 200
End With

end sub
 
J

JLGWhiz

I couldn't get it to work either. It gives me an error for both width and
height as unable to set for ChartArea class. It did work for setting the
pattern for the chart area, so I'm thinking that this is a Microsoft SNAFU.
 
P

Peter T

The chartarea's width & height properties are read only, determined by the
chartobject's size, just a couple of pixels or so inside allowing for the
border. So to change the chartarea's size re-size the chartobject. You can
re-size the PlotArea though the chart would need at least one series.

In passing, in a chart-sheet the chartarea's size is determined by the
sheet's PageSetup settings.

Regards,
Peter T
 

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