How to return a selected shape that is under another shape?

J

Judy Y Yang

I can get the selected shape when this shape is on the top of the group
shapes. but how can I get the selected shape when this shape is under another
shape in a group shapes? This is in "Drawing Control" in Visio 2003.
 
D

David Parker

Not sure if you are trying to get the Selected Shape that is inside a group?
If so, then you are right that ActiveWindow.Selection is Nothing
Here's a possible workaround:

Public Sub GetSel()
Dim shp As Visio.Shape
Dim shpParent As Visio.Shape

If Visio.ActiveWindow.Selection.Count = 0 _
And Not Visio.ActiveWindow.SelectedText Is Nothing Then

Set shp = Visio.ActiveWindow.SelectedText.Shape
Set shpParent = shp.ContainingShape

Debug.Print shpParent.Name, shp.Name
End If

End Sub
 

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