error when resizing chartarea programaticly

  • Thread starter Thread starter TONY
  • Start date Start date
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
 
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
 
Back
Top