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)
lastsite = secondRect.ConnectionSiteCount
With s.AddConnector(kmsoConnectorCurve, 0, 0, 100, 100).ConnectorFormat
.BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
.EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
End With
With s.AddConnector(ksoConnectorCurve, 0, 0, 100, 100) _
.ConnectorFormat
.BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
.EndConnect ConnectedShape:=secondRect, _
ConnectionSite:=lastsite
End With