SetShapesDefaultProperties Method

Microsoft Word Visual Basic

SetShapesDefaultProperties Method

       

Applies the formatting of the specified shape to a default shape for that document. New shapes inherit many of their attributes from the default shape.

expression.SetShapesDefaultProperties

expression   Required. An expression that returns a Shape or ShapeRange object.

Remarks

Using this method is equivalent to using the Set AutoShape Defaults command on the Draw menu on the Drawing toolbar.

Example

This example adds a rectangle to myDocument, formats the rectangle's fill, applies the rectangle's formatting to the default shape, and then adds another (smaller) rectangle to the document. The second rectangle has the same fill as the first one.

Set mydocument = ActiveDocument
With mydocument.Shapes
    With .AddShape(msoShapeRectangle, 5, 5, 80, 60)
        With .Fill
            .ForeColor.RGB = RGB(0, 0, 255)
            .BackColor.RGB = RGB(0, 204, 255)
            .Patterned msoPatternHorizontalBrick
        End With
        ' Sets formatting for default shapes
        .SetShapesDefaultProperties
    End With
    ' New shape has default formatting
    .AddShape msoShapeRectangle, 90, 90, 40, 30
End With