将指定图形的格式设置为图形的默认格式。
expression.SetShapesDefaultProperties
expression 必需。该表达式返回一个 Shape 对象或 ShapeRange 集合。
本示例向 myDocument
中添加矩形,设置该矩形的填充样式,将矩形的格式设置为该矩形的默认格式,然后在文档中添加另一个较小的矩形。第二个矩形的填充格式与第一个矩形一样。
Set myDocument = Worksheets(1)
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
' Set formatting as default formatting
.SetShapesDefaultProperties
End With
' Create new shape with default formatting
.AddShape msoShapeRectangle, 90, 90, 40, 30
End With