ShapeRange.ScaleWidth Method (Project)

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


expression. ScaleWidth (Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a 'ShapeRange' object.


Name Required/Optional Data type Description
Factor Required Single The ratio between the width of the shape after you resize it and the current width. For example, to make a rectangle 50 percent wider, 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.
Factor Required FLOAT
RelativeToOriginalSize Required MSOTRISTATE
fScale Optional MSOSCALEFROM

Return value



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


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