Unable to get info about Individual Shapes Within a Group

D

Denis Zavadil

When one or more shapes within a group are selected
ActiveWindow.Selection.Count = 0. When the group is selected
ActiveWindow.Selection.Count = 1. I am attempting to get information about
the individually selected items within the group and can't. Is there an
alternative to the ActiveWindow.Selection?
 
C

Chris Roth

Denis,

You need to go into the group and access the subshapes. Shapes can have
collections of shapes, ie: shp.Shapes(). You can check the type of shape to
see if it is a group, or simply check shp.Shapes.Count.

Check this out:

Sub DoGroup()

Dim shp As Visio.Shape, shpSub As Visio.Shape
Dim i As Integer

Set shp = Visio.ActiveWindow.Selection(1)

If shp.Type = Visio.VisShapeTypes.visTypeGroup Then
For i = 1 To shp.Shapes.Count
Set shpSub = shp.Shapes(i)
Debug.Print shpSub.Name, shpSub.Cells("PinX").ResultIU,
shpSub.Cells("PinY").ResultIU
Next i
End If

End Sub

--

Hope this helps,

Chris Roth
Visio MVP
visioguy @ extremely warm mail.com
 

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