Most of my Visio diagrams have simple connections between shapes, and my previous post about connections used a flowchart as an example (see https://blog.bvisual.net/2016/08/09/understanding-visio-connections/ ). However, it has come to my attention that some Visio developers add connection points to sub-shapes of Visio group shapes, and then connect between the sub-shapes. This means that the code in my previous article would need to be adapted to cater for this scenario. It has also meant that I needed to update my free multiSelect Visio add-in needed an update. The updated version (18.104.22.168) is for Visio 2010+, and is available from http://bvisual.net/Products/multiSelect.aspx .
I have added in three more options into the multiSelect add-in that work with the Parent, Children and Siblings actions:
- Keep source selected – previously the actions dropped the original shape from the selection.
- Include sub-shapes – it can take longer to explore the sub-shapes of large shapes, so I made it optional
- Prefer sub-shapes – if connected to a sub-shape, then select the sub-shape rather than the parent group shape
There were a couple of challenges in adapting the code.
- Recognising that the connected shape was a sub-shape
- Selecting a sub-shape programmatically
I solved the first challenge by testing if the Connect.ToSheet.ContainingShape.ID equals 0 for the end of a connector. If it is, then the shape it is connected to has the page as a parent; if not, then the ID is the parent shape, which can be retrieved using Page.Shapes.ItemFromID(…).
The second challenges was surprisingly more difficult. The Window.Select(…) method has an argument for the type of selection. The trick is to select the group shape first using visSelectArgs.visSelect, and then to immediately select the sub-shape using visSelectArgs.visSubSelect.
Knowing that the diagrams/schematic can be quite large, thus requiring multiple pages, can you make it continue to the next page?
How are you making it continue to the next page?
Maybe using a continuation or next page or to/from shape?
Philippe LE PAGE says
I can’t install your multiselect addin on my Visio Pro 2016. The installation succeeds however I can’t see new addin on Visio and I can’t add the multiSelect.dll as an addin…
I have it installed ok in my copy of Visio Pro.
Does it appear under Active Application Add-ins in File / Options / Add-ins ?
Please be aware that nothing shows in the Visio UI until you select a shape.
Philippe LE PAGE says
Thank you for your quick reply. No it doesn’t appear under Active Application Add-ins in File / Options / Add-ins, that’s why I try to add it manually. BTW I don’t know if my copy of Visio Pro is a 32 or a 64 bits version, so I’ve tried both.
You can check under File / Account / About
multiSelect should install 5 files in \bVisual\multiSelect
Does it appear in any other panel on File / Options / Add-ins ?
Do you have anything ticked under File / Options / Trust Center / Add-ins ?