使用 VBA 将连接器的宽度更改为 Visio 中的特定对象

Changing width of connectors to a specific object in Visio with VBA

我正在尝试创建一个宏来更改连接到特定块的连接器的厚度。这是我目前所拥有的:

Private Sub HighlightPaths_Click()

Dim selection As Shape
Dim connections() As Long
Dim i As Integer

'Msgbox glued shapes
If ActiveWindow.selection.Count = 0 Then

MsgBox ("Select a shape then click this button.")

Else

'Set shape to current selection
Set selection = ActiveWindow.selection(1)

'Get array of connectors on selected object
connections() = selection.GluedShapes(visGluedShapesAll1D, "")

'Resize connectors to that shape [ERROR HERE]   
For i = 0 To UBound(connections())
    connections(i).Cells("LineWeight").Formula = "0.5 pt"
Next

End If
End Sub

我知道这是因为我正在尝试以不适用的类型访问单元格 属性。我是否必须在主控形状列表中搜索 Glue 方法的 returns 才能找到动态连接器主控形状?

数组 connections(),包含连接的形状 ID。 在更改线宽之前,您需要获取形状对象。

ActivePage.Shapes(connections(i)).Cells("LineWeight").Formula = "0.5 pt"