Shape.ScaleWidth method (Project)

Scales the width of the shape by a specified factor.

Syntax

expression.ScaleWidth (Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a Shape object.

Parameters

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 the 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
Name Required/Optional Data type Description

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, and then scales the first shape 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)
    
    shp1.ScaleHeight 2, msoFalse
    shp1.ScaleWidth 2, msoFalse

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

See also

Shape 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.