ScaleWidth Method

       

Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.

expression.ScaleWidth(Factor, RelativeToOriginalSize, fScale)

expression   Required. An expression that returns one of the objects in the Applies To list.

Factor  Required Single. Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.

RelativeToOriginalSize  Required MsoTriState. Specifies whether to scale relative to the object's original or current size.

MsoTriState can be one of these MsoTriState constants.
msoCTrue  Not used with this method.
msoFalse  Scales the shape relative to its current size.
msoTriStateMixed  Not used with this method.
msoTriStateToggle  Not used with this method.
msoTrue  Scales the shape relative to its original size.

fScale  Optional MsoScaleFrom. The part of the shape that retains its position when the shape is scaled.

MsoScaleFrom can be one of these MsoScaleFrom constants.
msoScaleFromBottomRight
msoScaleFromMiddle
msoScaleFromTopLeft default

Remarks

Shapes other than pictures and OLE objects are always scaled relative to their current width; specifying a RelativeToOriginalSize value of msoTrue for shapes other than pictures or OLE objects causes an error.

Use the ScaleHeight method to scale the height of a shape.

Example

This example scales all pictures and OLE objects on the first page of the active publication to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

' Looping variable.
Dim shpLoop As Shape

' Loop through all the shapes on the first page.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
    With shpLoop
        Select Case .Type
            ' If the shape is a picture or OLE object,
            ' scale relative to original size.
            Case pbPicture, pbLinkedPicture, _
                    pbEmbeddedOLEObject, pbLinkedOLEObject, _
                    pbOLEControlObject
                .ScaleHeight Factor:=1.75, _
                    RelativeToOriginalSize:=True
                .ScaleWidth Factor:=1.75, _
                    RelativeToOriginalSize:=True
            ' If the shape is not a picture or OLE object,
            ' scale relative to the current size.
            Case Else
                .ScaleHeight Factor:=1.75, _
                    RelativeToOriginalSize:=False
                .ScaleWidth Factor:=1.75, _
                    RelativeToOriginalSize:=False
        End Select
    End With
Next shpLoop