更改连接器样式

时间:2012-08-28 07:13:57

标签: vba visio

我想突出显示Shape对象的连接器,但它没有为连接器本身提供任何LineStyle属性。这是我到目前为止所得到的:

    For i = 0 To UBound(lngShapeIDs)
      Dim shp As Shape

      Dim connect As connect
      Set shp = ActivePage.Shapes.ItemFromID(lngShapeIDs(i))
      shp.LineStyle = "Guide"
      shp.BringToFront
      Set connect = shp.FromConnects.Item(i + 1)
    Next 

1 个答案:

答案 0 :(得分:3)

根据您的评论,我认为您正在寻找

Dim shape As shape
For Each shape In ActivePage.Shapes
    If (shape.OneD <> 0) Then
        shape.CellsU("LineColor").Formula = "rgb(255,0,0)"
        shape.BringToFront
    End If
Next

此示例枚举页面中的所有形状。它假设“1-D”形状是需要修改的连接器。对于这些连接器,它们的线条颜色设置为红色,并且它们都被放在前面。

因此,如果这是绘图的初始状态:

enter image description here

然后在运行VBA代码后,绘图将如下所示:

enter image description here