Shape.SetShapesDefaultProperties 方法 (Excel)

将指定形状的格式设置为形状的默认格式。

语法

表达式SetShapesDefaultProperties

表达 一个代表 Shape 对象的变量。

示例

此示例向 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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。