trying to set chart width

  • Thread starter Thread starter bbxrider
  • Start date Start date
B

bbxrider

my chart width can change due to setting axes, etc and i want to keep it a
certain size
have tried code like below, when the 'width' number i thought was points 72
per inch to keep chart at 6"
but not working, can this be done or is it a 'relative' size

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").Width 452, msoFalse,
msoScaleFromTopLeft
 
I prefer to work with the ChartObject instead of the Shape:

ActiveSheet.ChartObjects("Chart 1").Width = 452

which seems to be in points. You can also set the width of a Shape with
the same syntax:

ActiveSheet.Shapes("Chart 1").Width = 452

The line of code you posted is almost the ScaleWidth method:

ActiveSheet.Shapes("Chart 1").Width 1.5, msoFalse, <corner>

The 1.5 in this line means stretch to 150% of its initial size. False
means relative to its current size; some objects allow you to use True,
relative to its original size. <corner> is the corner that stays put
when you stretch it. If you're going to an absolute size, you don't want
ScaleWidth.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
thanks very much, i had macroed a size change and got fooled by the scale
width syntax
when trying to use it with 'point' width
 
Back
Top