我刚刚继承了一个绘制组织结构图的Excel应用程序。每个形状都通过Line
但是,我需要删除添加每一行时绘制的阴影。如何获得Lines
的集合,以便我可以执行类似
Line.Shadow.Transparency = 1.0
我是一个vba新手: - )
答案 0 :(得分:0)
这应该可以做到 - 它遍历所有形状,检查它们是否是一条线,然后移除阴影。
Sub test()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim shapeObj
For Each shapeObj In ActiveSheet.Shapes
If shapeObj.Type = 9 Then
Dim objName$
objName = shapeObj.Name
ws.Shapes.Range(Array(objName)).Shadow.Visible = msoFalse
End If
Next shapeObj
End Sub
编辑:结果,根据OP,形状被分组,所以他用它来得到它:
Sub RemoveLineShadows()
For Each Shp In ORG.Shapes
If Shp.Type = msoGroup Then
For X = 1 To Shp.GroupItems.Count
If Shp.GroupItems(X).Type = msoLine Then
Shp.GroupItems(X).Shadow.Transparency = 1
End If
Next X
End If
Next Shp
End Sub
答案 1 :(得分:0)
Sub qqq()
Dim x As Shape
For Each x In ActiveSheet.Shapes
x.Shadow.Visible = msoFalse
Next
End Sub