ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   error when resizing chartarea programaticly (https://www.excelbanter.com/charts-charting-excel/169915-error-when-resizing-chartarea-programaticly.html)

tony

error when resizing chartarea programaticly
 
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

Jon Peltier

error when resizing chartarea programaticly
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"TONY" wrote in message
...
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





All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com