ShapeRange.ScaleHeight method (Project)

Scales the height of the range of shapes by a specified factor.

Syntax

expression.ScaleHeight (Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a 'ShapeRange' object.

Parameters

Name Required/Optional Data type Description
Factor Required Single The ratio between the height of the shape after you resize it and the current height. For example, to make a rectangle 50 percent higher, specify 1.5 for the Factor parameter.
RelativeToOriginalSize Required MsoTriState msoFalse scales each shape relative to its current size. For Project, the value must be msoFalse.
fScale Optional MsoScaleFrom Specifies which part of the shape retains its position when the shape is scaled.

Return value

Nothing

Remarks

A RelativeToOriginalSize parameter value of msoTrue scales a shape relative to its original size, which applies only to a picture or OLE object.

Example

The following example creates two cylindrical shapes, assigns them to a shape range, and then scales the shapes in height and width. If you set a breakpoint on the first ScaleHeight statement, you can step through the code and see the changes from scaling and from using the fScale parameter.

Sub ScaleShapes()
    Dim theReport As Report
    Dim shp1 As shape
    Dim shp2 As shape
    Dim reportName As String
    Dim sRange As ShapeRange
    
    reportName = "Scale Report"
    
    Set theReport = ActiveProject.Reports.Add(reportName)
    Set shp1 = theReport.Shapes.AddShape(msoShapeCan, 20, 50, 20, 30)
    Set shp2 = theReport.Shapes.AddShape(msoShapeCan, 140, 50, 30, 50)
        
    Set sRange = theReport.Shapes.Range(Array(1, 2))
    sRange.ScaleHeight 2, msoFalse
    sRange.ScaleWidth 2, msoFalse

    sRange.ScaleHeight 2, msoFalse, msoScaleFromMiddle
    sRange.ScaleWidth 2, msoFalse, msoScaleFromTopLeft
End Sub

See also

ShapeRange Object MsoTriState MsoScaleFrom

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.