怎么判断Excel是否存在一个椭圆图形(VBA)
2个回答
展开全部
Sub Macro1()
For i = 1 To ActiveSheet.Shapes.Count
If InStr(1, ActiveSheet.Shapes(i).Name, "Oval") <> 0 Then
MsgBox "存在椭圆图形" & ActiveSheet.Shapes(i).Name
ActiveSheet.Shapes(i).Select
ActiveSheet.Shapes("Oval 2").Select
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 3#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 48
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 48
Selection.ShapeRange.Fill.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Patterned msoPatternSolidDiamond
Exit For
End If
Next
End Sub
For i = 1 To ActiveSheet.Shapes.Count
If InStr(1, ActiveSheet.Shapes(i).Name, "Oval") <> 0 Then
MsgBox "存在椭圆图形" & ActiveSheet.Shapes(i).Name
ActiveSheet.Shapes(i).Select
ActiveSheet.Shapes("Oval 2").Select
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 3#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 48
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 48
Selection.ShapeRange.Fill.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Patterned msoPatternSolidDiamond
Exit For
End If
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询