CropRight Property

Microsoft Publisher Visual Basic

expression.CropRight

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

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Negative values crop the bottom edge away from the center of the frame and positive values crop toward the left edge of the frame.

The valid range of crop values depends on the frame’s position and size. For an unrotated frame, the lowest negative value allowed is the distance between the right edge of frame and the right edge of the scratch area. The highest positive value allowed is the current frame width.

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it's 200 points wide, and then set the CropRight property to 50, 100 points (not 50) will be cropped off the right of your picture.

Use the CropLeft , CropTop , and CropBottom properties to crop other edges of a picture or OLE object.

Example

This example crops 20 points off the right of the third shape in the active publication. For the example to work, the shape must be either a picture or an OLE object.

ActiveDocument.Pages(1).Shapes(3).PictureFormat _
    .CropRight = 20
		

This example crops the percentage specified by the user off the right of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

Dim sngPercent As Single
Dim shpCrop As Shape
Dim sngPoints As Single
Dim sngWidth As Single

sngPercent = InputBox("What percentage do you " & _
    "want to crop off the right of this picture?")

Set shpCrop = Selection.ShapeRange(1)
With shpCrop.Duplicate
    .ScaleWidth Factor:=1, _
        RelativeToOriginalSize:=True
    sngWidth = .Width
    .Delete
End With

sngPoints = sngWidth * sngPercent / 100

shpCrop.PictureFormat.CropRight = sngPoints