myDocument
中添加两个矩形,用一个连接符连接这两个矩形,并自动将连接符路径修改为最短路径,然后断开矩形间的连接符。
Set myDocument = ActiveDocument
Set s = myDocument.Shapes
Set firstRect = s.AddShape(ksoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(ksoShapeRectangle, 300, 300, 200, 100)
With s.AddConnector(ksoConnectorCurve, 0, 0, 0, 0).ConnectorFormat
.BeginConnect firstRect, 1
.EndConnect secondRect, 1
.BeginDisconnect
.EndDisconnect
End With