这里有新手问题。
在visio项目中,我想编写VBA来快速更改原理图中的线条属性。 到目前为止,它是可行的,除非行在组中。有什么想法吗?
这是我当前正在使用的代码:
Dim shp As Visio.Shape
For Each shp In Visio.ActiveWindow.Selection
'// Add cell and formula/results here:
shp.Cells("linecolor") = 0
Next shp
Set shp = Nothing
End Sub
谢谢!
答案 0 :(得分:1)
这是我的最终代码,以防其他人寻找相同的问题:
For Each shp In Visio.ActiveWindow.Selection
shapeCount = shp.Shapes.Count
If shapeCount > 0 Then
For Each shp2 In shp.Shapes
'// Add cell and formula/results here:
shp2.Cells("linecolor") = 0
Next shp2
End If
Next shp
答案 1 :(得分:0)
对于每种形状,您需要检查组中形状的数量,即。
shp.shapes.count> 0
然后遍历那些形状,并在那里设置线条颜色。
每个shp2形状的shp2
当然,这些形状中的每一个也可以是一个组,因此这里需要一个递归例程。