将指定图形的格式应用于该文档中的默认图形。新图形将继承默认图形的许多属性。
expression.SetShapesDefaultProperties
expression 必需。该表达式返回一个 Shape 或 ShapeRange 对象。
此方法的使用等效于“绘图”工具栏的“绘图”菜单中的“设置自选图形的默认效果”命令。
本示例将一个矩形添至 myDocument
,设置矩形的填充格式,将矩形的格式应用于默认图形,然后将另一个(较小的)矩形添至文档。后一个矩形与前一个矩形有相同的填充格式。
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