![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 23
|
Hi.
Is it possible to program the width and height of an object added onto a chart? To position a range I can use: selection.shaperange.left = value selection.shaperange.top = value But, if I want to change the proportions of the actual shape (not the shape range), is it possible? selection.shaperange.width/height do not seem to work. Thanks, Corey |
|
|
|
|
|
#2 |
|
New Member
Join Date: Mar 2002
Posts: 23
|
What I want is for the horizontal size of the object (basically a legend for the x-axis that is located at the top of the chart area) to be equal to the horizontal length of the chart/plot area. Is it possible to find the width of the plot area, then set the width of the object to that same value?
Thanks, Corey |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Wellington
Posts: 104
|
Hi,
It is possible to change the shape and position of you object: I guess position you have figured out, and the codes for width and height are: Sheet1.ComboBox1.ShapeRange.Left = 50 Sheet1.ComboBox1.ShapeRange.Top = 100 Sheet1.ComboBox1.Width = 100 Sheet1.ComboBox1.Height = 20 The last two lines. Hope it helps. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 23
|
Thanks for the reply. That doesn't seem to work for me, though.
The object I'm trying to resize is located on a chart. I don't know if that makes a difference or not. This is the code I'm using: Sub MoveObject() ActiveSheet.ChartObjects("Chart 11").Activate ActiveChart.ChartArea.Select ActiveChart.Shapes("Group 23").Select Selection.ShapeRange.LockAspectRatio = msoFalse Selection.ShapeRange.Height = 45 Selection.ShapeRange.Width = 413 Selection.ShapeRange.Left = 65 Selection.ShapeRange.Top = 10 End Sub The size of the object will not change, regardless of what I put as values for the height/width. I've tried with the aspect locked/unlock, and that doesn't do anything to help me either. It seems to be resizing the range of the shape, but not the object itself (best way I can think to describe it is to think of a gif image: if you change the height/width attributes, the image itself doesn't change, just the size of the 'box' or 'container' the picture is located in - thus you have more room to put in extra info such as a second image). Any more help/ideas? Thanks, Corey |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 23
|
Tried to use this also, with no luck:
ActiveChart.Shapes("Group 23").Height = 45 ActiveChart.Shapes("Group 23").Width = 413 Can anyone help? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|