主题
Type (属性)
返回一个代表形状类型的 MsoShapeType 值。只读。
示例
python
#本示例判断第一张工作表中第一个形状的类型是否为图片
def test():
shapes = Application.Worksheets.Item(1).Shapes
print(shapes.Item(1).Type == msoPicture)
python
#本示例判断活动工作表中第二个形状是否为图表并显示结果
def test():
shapes = ActiveSheet.Shapes
if shapes.Item(2).Type == msoChart:
print("This is a Chart")
else:
print("This is not a Chart")