2

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)

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
Arthes
  • 79
  • 1
  • 8

1 Answers1

1

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")
SmrtGrunt
  • 869
  • 12
  • 25