error when resizing chartarea programaticly

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

Jon Peltier

You can't change the chart area of an embedded chart; it is defined by the
width of the chart object. Try this:

co.Width = 205

You need to make the chart object a few points wider (~ 205 I'm guessing)
than the chart area (200) of the chart it contains.

- Jon
 

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