Arthes
Arthes

Reputation: 79

VBA connect using named connection points

I have a few shapes with named connection points. Is there any way to connect them using their name?

I don't want to connect them using x,y co-ordinates.

Example:

Say I have two shapes S1, S2.

Connection points on S1: C11, C12
Connection points on S2: C21, C22

Now can I specify Connect S1(C11) -> S2(C21)

Upvotes: 2

Views: 594

Answers (1)

SmrtGrunt
SmrtGrunt

Reputation: 919

Yes. Say you have two shapes on a Visio page object (vzpVisioPage), the starting shape and the ending shape:

Set vsoStartShape = vzpVisioPage.Shapes.Item(varSomeIndex)
Set vsoEndShape = vzpVisioPage.Shapes.Item(varSomeOtherIndex)

The custom connection points will be in the Connections section of the shapesheet.

Create a connector shape and glue it as follows:

Set vsoConnectorShape = vzpVisioPage.Drop(vzpVisioPage.Application.ConnectorToolDataObject, 0, 0)
vsoConnectorShape.CellsU("BeginX").GlueTo vsoStartShape.Cells("Connections.C11")
vsoConnectorShape.CellsU("EndX").GlueTo vsoEndShape.Cells("Connections.C21")

Upvotes: 1

Related Questions