Reputation: 87
I'm having some troubles connecting a linked dynamic connector which actually connects to a pre-defined connection point instead of just connection to the top.
My master has some text boxes at the left side and some at the right side. When I auto connect to those text boxes they all connect fine except the first and last one. Instead of connecting to the side like the others they connect to the top and bottom in the middle of the box which ruins the visual effect. Even though there is a connection point defined at the side.
I have been looking at using GlueTo to connect manually to the connection point but I can't figure out how to adress the connection point.
Set vsoConnectorShape = ActiveDocument.Masters.ItemU("Dynamic connector")
Set BoxShape = ActivePage.Shapes(i)
Set DevShape = ActivePage.Shapes(j)
NewRow = DevShape.AddRow(visSectionConnectionPts, visRowLast, visTagDefault)
DevShape.CellsSRC(visSectionConnectionPts, NewRow, visX).Formula = "Width*0"
DevShape.CellsSRC(visSectionConnectionPts, NewRow, visY).Formula = "Height*0.5"
DevShape.AutoConnect BoxShape, visAutoConnectDirLeft, vsoConnectorShape
So my actual question would be how do i connect to a connection point instead of the shape itself?
Upvotes: 2
Views: 2712
Reputation: 3877
You can glue the .Cells("BeginX")
or .Cells("EndX")
of a connector
Shape.Cells("PinX")
Shape.CellsSRC(visSectionConnectionPts, row, column)
If you click the shape and open its ShapeSheet by right mouseclick, you'll find a section "Connection Points". Each row of this table represents one connection point - click on the row in the table and see which one is selected in your drawing.
Use the row number starting with 0 for CellSRC
The column number is not relevant and can be 0 or 1 = visCnnctX or visCnnctY
Alternatively just catch a manual connection with the macro recorder
and search in the code for e. g.
CellSRC(7, 0, 0)
7 = visSectionConnectionPts, 0 = 1st connection point, 0
Dim myConnector As Visio.Shape
' drop it somewhere
Set myConnector = ActiveWindow.Page.Drop(Application.ConnectorToolDataObject, 1, 10)
' connect it to the nearest connection point of a shape (varies if you drag)
myConnector.Cells("BeginX").GlueTo BoxShape.Cells("PinX")
' connect it a fixed connection point (example if shape has 4 points)
myconnector.Cells("BeginX").GlueTo _
Boxshape.CellsSRC(visSectionConnectionPts, 0, 0) ' left
' .CellsSRC(visSectionConnectionPts, 1, 0) ' right
' .CellsSRC(visSectionConnectionPts, 2, 0) ' top
' .CellsSRC(visSectionConnectionPts, 3, 0) ' bottom
Upvotes: 2