Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Connector attachment points change when you move the connected shape

Problem

A connector (Arrow A, let's say) is attached to one of the attachment points on a shape (we'll call it Rectangle B).

In code, you change the position of Rectangle B by modifying its .Left or .Top properties.

Arrow A becomes attached to the wrong attachment point.

Manual workarounds

If you detach the connectors from the shapes they're attached to before running the code that causes this, you can later attach the connectors to the correct shapes again.

Or change the height or width of the attached shape slightly. The connector will re-attach itself to the correct attachment point.

Solution

To solve the problem in code, one approach is to:

For each shape on the slide, check its .Connector property to see if it is, in fact, a connector.

If it is, check its .ConnectorFormat.BeginConnected and .ConnectorFormat.EndConnected properties to see if it's start or end points are connected to other shapes.

If so, .BeginConnectedShape and .EndConnectedShape will give you references to the shapes the start and end points are connected to, and .BeginConnectionSite/.EndConnectionSite will return Longs that indicate which of the shape's connection points the connector is attached to.

Record those values in whatever way suits your purposes, then use .BeginDisconnect and/or .EndDisconnect to disconnect the connector from the shape.

Then it'll be safe to move the connected shape (and if necessary, the connector).

Finally, for each connector on the slide, retrieve your reference to the connected shape and connection point, reset those on the connector using the .BeginConnect and .EndConnect commands.

Hint: It would be wise not to rely on the .Name property to retrieve the connected shapes before connecting them again. This explains why:

The Name property of PowerPoint shapes is not reliable


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Connector attachment points change when you move the connected shape
http://www.pptfaq.com/FAQ01217-Connector-attachment-points-change-when-you-move-the-connected-shape.htm
Last update 12 June, 2015
Created: 12 June, 2015