Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
65 lines (41 loc) · 1.84 KB

shape-rerouteconnections-method-publisher.md

File metadata and controls

65 lines (41 loc) · 1.84 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date
Shape.RerouteConnections Method (Publisher)
vbapb10.chm2228260
vbapb10.chm2228260
publisher
Publisher.Shape.RerouteConnections
04afd4aa-dc84-d39c-e9fa-d06f8f4c0a02
06/08/2017

Shape.RerouteConnections Method (Publisher)

Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.

Syntax

expression. RerouteConnections

_expression_A variable that represents a Shape object.

Remarks

This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it is rerouted.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector. Note that the RerouteConnections method overrides the values you supply for the ConnectionSite arguments used with the BeginConnectand EndConnect methods.

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