Okay, here's another one:
1. Take two shapes and group them.
2. Select the group, and ActiveWindow.Selection.Count=1.
3. But select only one of the shapes inside the group, and (as the title implies) ActiveWindow.Selection.Count=0, even though a shape is surely selected.
What am I missing? How can you know when a sub-shape alone is selected? How can I access its shapesheet?
- Ken
You forgot to tell Visio to select sub-shapes: https://msdn.microsoft.com/en-us/VBA/Visio-VBA/articles/selection-iterationmode-property-visio
Set sel = ActiveWindow.Selection
sel.IterationMode = visSelModeSkipSuper
for each shp in sel ...
Yacine:
Huh! Never heard of the option before. Pretty cool. And it did the trick! Ya learn something new every day.
(And pardon the quibble, but logically speaking I could not "forget" something I never knew... ;- )
Of course I had to play with it, and noted that it refuses to allow sel.IterationMode = visSelModeSkipSuper + visSelModeOnlySuper. Ditto for SkipSub and OnlySub. "Invalid parameter," it tells me. Indeed.
Regardless, it's now another arrow in my increasingly-overcrowded Visio quiver. Thanks muchly!
- Ken