Search code examples
vbams-officevisio

Visio VBA : Connect a line shape to two other shapes


I am dropping shapes on my Page via VBA UserForms. Amongst others I need to drop a "curved line" shape which should connect two specified shapes.

I found out how to directly create a connection here but I want the shape from my specific master because it has some custom Data Properties.

I expected there to be some Fields in the DataSheet of the Connector-Shape where I could reference the start and end shapes? could not find anything more helpful.

Thanks for any hints!


Solution

  • Solution from here

    Dim shp As Visio.Shape 'connector
    Dim src As Visio.Shape 'connect this
    Dim aim As Visio.Shape 'to this
    
    [...] 'Set shape variables
    
    shp.Cells("BeginX").GlueTo src.Cells("PinX")
    shp.Cells("EndX").GlueTo aim.Cells("PinX")