excelvbavisioconnectorpins

Connection from connector's pin to another connector's pin


Is there any way to select "pin" in this method?:

Application.ActiveWindow.Page.Shapes.ItemFromID(1).AutoConnect

I want to connect two shapes and then I want to connect third one onto created connection, but not at beginning, I need to connect it onto fourth pin. This is what I have: enter image description here
This is what I want to have: enter image description here

Any idea?


Solution

  • To get center of shape we have to use this lines.

    Set object = AppVisio.ActiveWindow.Page.Shapes.ItemFromID(objectId)
    connectingXfrom = object .CellsU("PinX").Result("in")
    connectingYfrom = object .CellsU("PinY").Result("in")
    

    The center of shape object is at point C[connectingXfrom, connectingYfrom]

    Next two lines move first point of connector to point P[connectingXfrom, connectingYfrom]

    Application.ActiveWindow.Page.Shapes.ItemFromID(connectorShapeId).CellsSRC(1, 4, 0).FormulaU = connectingXfrom
    Application.ActiveWindow.Page.Shapes.ItemFromID(connectorShapeId).CellsSRC(1, 4, 1).FormulaU = connectingYfrom
    

    If we want to start connecting from connection 1 but close to object 2, we need to do:

    connectingXfrom = connectingXfrom - someDistanceValue