Identifying Group Shapes

K

ken.street

I have a master group shape into which I drop either another group
shape or a single item shape. I need to identify whether the new
dropped shape is a group or not so I used the following code:

Set vsoSelection = ActiveWindow.Selection
vsoSelection.IterationMode = visSelModeOnlySub
If vsoSelection.Count = 0 Then

I believed that the single dropped item would return a Count of 0
whereas the dropped group shape would give me the number of sub items
in the group, however both shapes are giving me a Count of 1??

If I drop the single shape outside of the master group shape then the
selection returns a Count of 0 so it must have something to do with
dropping the shape into a group??

Any help much appreciated.

Regards
Ken
 
J

JuneTheSecond

Before you run IterationMode, you might select child sheets in the group.
So you might faster to reach goal, if you directly count child sheets in the
group.
N=objShp.Shapes.Count
 
K

ken.street

JuneTheSecond

Thanks for your help but my master group has a collection of single and
group items and I am trying to determine the type of the newly selected
and dropped shape. Are you suggesting doing the objShp.Shapes.Count on
the dropped shape or on the master group. I understood you couldn't
access shape properties on a selection until you had run IterationMode?
I am not clear about you are suggesting and would like more guidance.

Thanks

Ken
 
C

Chris Roth [MVP]

I like Shape.Count, but there's also Shape.Type. These are the constants as
listed in Visio's developer reference:

visTypeBitmap
32
Returned by Shape.ForeignType if the shape is a bitmap.

visTypeDoc
6
The document's DocumentSheet.

visTypeForeignObject
4
An imported shape.

visTypeGroup
2
A shape that contains other shapes.

visTypeGuide
5
A shape that is a guide.

visTypeInk
64
Returned by Shape.ForeignType if the shape is ink.

visTypeInval
0
The type of no shape. Means all types when used as filter code.

visTypeIsControl
1024
Returned by Shape.ForeignType if the shape is a control.

visTypeIsEmbedded
512
Returned by Shape.ForeignType if the shape is embedded.

visTypeIsLinked
256
Returned by Shape.ForeignType if the shape is linked.

visTypeIsOLE2
32768
Returned by Shape.ForeignType if the shape is linked, embedded, or a
control.

visTypeMetafile
16
Returned by Shape.ForeignType if the shape is a metafile.

visTypePage
1
Page's or master's PageSheet.

visTypeShape
3
Native Visio shape.




You can see visTypeGroup and visTypeShape, which are the ones you're
interested in.

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 

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