VISIO VBA更改组中线条的颜色

这里有新手问题。

在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

谢谢!

qq1988110 回答:VISIO VBA更改组中线条的颜色

这是我的最终代码,以防其他人寻找相同的问题:

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
,

对于每种形状,您需要检查组中形状的数量,即。

shp.shapes.count> 0

然后遍历那些形状,并在那里设置线条颜色。

每个shp2形状的shp2

当然,这些形状中的每一个也可以是一个组,因此这里需要一个递归例程。

本文链接:https://www.f2er.com/2995171.html

大家都在问