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

Set mydocument = ActivePresentation.Slides(1)
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
        ' Sets formatting for default shapes
        mydocument.Shapes(1).Select ksoTrue
       Windows(1).Selection.ShapeRange.SetShapesDefaultProperties
    End With
    ' New shape has default formatting
    .AddTextbox ksoTextOrientationHorizontal, 90, 90, 40, 30
End With