本示例将一个矩形添至 myDocument,设置矩形的填充格式,将矩形的格式应用于默认图形,然后将另一个(较小的)矩形添至文档。后一个矩形与前一个矩形有相同的填充格式。

Set mydocument = ActiveDocument
With mydocument.Shapes
    With .AddShape(ksoShapeRectangle, 5, 5, 80, 60)
        With .Fill
            .ForeColor.RGB = RGB(0, 0, 255)
            .BackColor.RGB = RGB(0, 204, 255)
            .Patterned KsoPatternHorizontalBrick
        End With
        ' Set formatting for default shapes
        mydocument.Shapes(1).Select ksoTrue
        Selection.ShapeRange.SetShapesDefaultProperties
    End With
    ' New shape has default formatting
    .AddTextbox ksoTextOrientationHorizontal, 90, 90, 40, 30
End With