Shapes not connected to connectors on drop from VBA and if gluedby VBA can have strange routing

A

Andy

If I have a dynamic connector on a diagram and drop a shape with a
connection point onto this connector, the connector connects to the shape.

If I do exactly the same thing using VBA. the connector does not connect
to the shape. I have to manually move the shape a fraction.

In my instance I am replacing an existing shape with a new shape, so I
now drop the new shape on top the old shape and using the connection
information from the old shape, glue the connector to the new shape.
This works perfectly about 99% of the time, but just occasionally the
connector gets routed all over the diagram.

This is the code I have to transfer the connections from the existing
shape to the new shape.

For intConnects = vsoShape.FromConnects.Count To 1 Step -1

Set fromCell = vsoShape.FromConnects(intConnects).fromCell
Set toCell =
dropShape.Cells(vsoShape.FromConnects(intConnects).toCell.name)

fromCell.GlueTo toCell

Next

Any suggestions as to how I can handle this reliably.

Thanks
 
J

JuneTheSecond

Would you please read about GlueTo method and Connect object in the help?
"fromCell" and "toCell" are really effective cells that GlueTo method can
connects?
 
A

Andy Wagg

I'm not sure what your telling me.

I do sucessfully glue to my new shape, my problem is that occasionally
the connector is routed over the rest of the diagram. What I'm trying
to do is to delete a shape, replace it by an identical shape and have
it connect. This works if you do this manually, but not with VBA. The
shape when dropped doesn't connect. So my solution was to drop may new
shape and take the connectors from the old shape and glue them to me
new shape. This works apart from the occasions when Visio seems to
screw up the routing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top