Search code examples
excelexcel-2010vba

Microsoft Excel 2010 Autoshape "Adjustments" Property (msoShapeTrapezoid)


Is there a reference available anywhere that details what each "adjustment property" does for the various Autoshape objects available in Excel 2010?

My specific problem is that I am programatically inserting an msoShapeTrapezoid autoshape onto a worksheet with:

.AddShape(msoShapeTrapezoid, Left, Top, Width, Height)

... which defines the rectangular extent of the trapezoid. Then I am attempting to use:

shpTrapezoid.Adjustments(1) = ValueX

to set the size of the top of the trapezoid (the equivalent of adjusting the single handle on the autoshape manually I guess), but I can't work out what this adjustment property represents (although I have figured out that a value of 0 makes the trapezoid a rectangle).

So given I know the size of the base of the trapezoid, the size of the top of the trapezoid and the height of the trapezoid I want to draw (and that it is symmetrical), what does ValueX have to be to correctly define it on the screen?


Solution

  • First of all, sorry for my poor english...

    I have been struggling with this problem during a couple of hours and I have found that the adjustment for the msoShapeTrapezoid is a coefficient that must be multiplied by the width of the form if the width is less than the height or by the height of the form if the height is less than the width.

    This also explains why this adjustment can be more than 0.5 (if the height of the form is less than its width, the adjustment can be more than 0.5: the max value is width divided by height but in the other case the max value is 0.5 ).

    So if you want to draw a trapezoid, the adjustment must be calculated like this: subtract the top of the trapezoid to the base, divide by 2 the result and divide the new result by the height of the trapezoid if the height is less than its width or by its width in the other case.

    This also applies to the msoShapeParallelogramm ;the adjustment must be multiplied by the Min(Width;Height).

    There are a lot of little bugs in these AutoShapes... (for example, the msoShapeRegularPentagone is not a regular pentagon... but the base is calculated by multiplying the width of the form by the Golden Ratio minus 1 and the "elevation " of the points located on the left and right side of the form is also equal to the GoldenRation minus 1 multiplied by the width of the form: the result is near to a regular pentagon but it is not)