在VBA中格式化Visio连接

时间:2017-07-24 14:47:58

标签: vba visio

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

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

2 个答案:

答案 0 :(得分:0)

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

  

设置shp = ActiveWindow.Selection.PrimaryItem
  shp.Cells(“LineWeight”)。公式=“0.5 pt”

答案 1 :(得分:0)

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 pt