在 VBA 中格式化 Visio 连接

Formatting Visio Connections in VBA

有没有办法通过 VBA 编辑连接?

例如,在 运行 VBA 脚本时更改连接线的线宽。

此代码更改了所选形状的线宽

Set shp = ActiveWindow.Selection.PrimaryItem
shp.Cells("LineWeight").Formula = "0.5 pt"

Sub Macro1() 
Dim shp As Shape, mst As Master 
' iterate all shapes per page 
For Each shp In ActivePage.Shapes 
' declare parent master for current shape 
Set mst = shp.Master 
' Process only shapes that have parent master-shape 
If Not (mst Is Nothing) Then 
' change only shapes, which master-shape is dynamic connector 
If mst.Name = "Dynamic connector" Then shp.Cells("LineWeight").Formula =  "0.5 pt"
End If
Next
End Sub 

此代码将页面上每个连接器的线宽设置为 0.5 磅