0cool
0cool

Reputation: 683

Cant delete all connection point of shape in visio

I am trying to delete all connection point of shape using following code but still some connection point does not get deleted. I don't understand why this happening

For currentRow = 0 To shape.Section(Visio.VisSectionIndices.visSectionConnectionPts).Count - 1
        shape.DeleteRow Visio.VisSectionIndices.visSectionConnectionPts, visRowFirst + currentRow
Next currentRow

Can anyone put some light on this part?

Upvotes: 1

Views: 2582

Answers (1)

user9182
user9182

Reputation:

The first time through your loop currentRow is 0. You therefore delete the row with index 0. The second row now becomes the first row and its index changes from 1 to 0. Your loop however increments currentRow to 1 so you skip the new first row. This repeats for each iteration and you skip every second row.

You can simply delete the first row until there are no remaining rows.

While Shape.RowExists(Visio.VisSectionIndices.visSectionConnectionPts, visRowFirst, 0)
  Shape.DeleteRow Visio.VisSectionIndices.visSectionConnectionPts, visRowFirst
Wend

Depending on your application, the simplest solution may be to delete the connection point section:

Shape.DeleteSection Visio.VisSectionIndices.visSectionConnectionPts

Upvotes: 1

Related Questions