Delete a connector of a shape

S

Sven Meirsman

Hi,

I'm working in VB.NET and using the visio automation.

I have a shape object and I can successfully iterate through the FromConnect
collection of this shape object. I would like to know if there is a way of
removing a Connector in this collection.

If this doesn't work, how can I disable Visio to automatically connect a
dropped shape if you drop it onto an other shape from VB.NET code.

regards,

Sven Meirsman
 
J

junethesecond

Connects collection has no method,
so you might have to delete the
connecting connectors.
To find connectors, FromSheet property
is helpful. You can find sample program
in the help documents,

Public Sub FromSheet_Example()

Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectFrom As Visio.Shape
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeIndex As Integer
Dim intCounter As Integer

Set vsoShapes = ActivePage.Shapes

For intCurrentShapeIndex = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeIndex)
Set vsoConnects = vsoShape.Connects

For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectFrom = vsoConnect.FromSheet

'Print the name of the shape the
'Connect object originates from.
Debug.Print vsoConnectFrom.Name

Next intCounter

Next intCurrentShapeIndex

End Sub
 
Top