Shape.RerouteConnections メソッド (Publisher)

RerouteConnections メソッドは、図形間を結ぶ線 (コネクタ) の経路が最短になるように、そのコネクタを再接続します。 そのため、コネクタの端点をいったん切り離し、図形の別の結合点に接続し直すことがあります。

構文

RerouteConnections

Shape オブジェクトを表す変数。

注釈

このメソッドは、指定された図形に接続されたすべてのコネクタの経路を再設定します。指定された図形がコネクタの場合、そのコネクタの経路が再設定されます。

次の使用例は、作業中の文書の先頭ページに 2 つの四角形を追加し、それらを曲線コネクタで結合します。 RerouteConnections メソッドは、BeginConnect メソッドと EndConnect メソッドで使用される ConnectionSite 引数に指定した値をオーバーライドすることに注意してください。

Dim shpRect1 As Shape 
Dim shpRect2 As Shape 
 
With ActiveDocument.Pages(1).Shapes 
 
 ' Add two new rectangles. 
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _ 
 Left:=100, Top:=50, Width:=200, Height:=100) 
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _ 
 Left:=300, Top:=300, Width:=200, Height:=100) 
 
 ' Add a new curved connector. 
 With .AddConnector(Type:=msoConnectorCurve, _ 
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _ 
 .ConnectorFormat 
 
 ' Connect the new connector to the two rectangles. 
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1 
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1 
 
 ' Reroute the connector to create the shortest path. 
 .Parent.RerouteConnections 
 End With 
 
End With 

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。