Title of container a shape is in

Started by tepebox, August 25, 2021, 08:06:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tepebox

Hi,

so I want to create a list of all connectors with title of the source and target they connect plus the title of the container source/target are in.

What I need:
- The list of connectors - done!
- The reference to the source/target shape and getting their title - done!
- The reference to the container source/target are in - I'm stuck...

I have a variable (object) with the source shape in it. Containerproperties should give me the reference to the container the shape is in... So I'm trying to do something like

set sourcecontainer = sourceshape.containerproperties

This works nicely.

Now I want to use it... Everything I tried to use sourcecontainer doesn't work... So i.e.

debug.print sourcecontainer.shape.title

Already a

set sourcecontainershape = sourcecontainer.shape

fails.

Any idea?

Yacine

Use the MemberOfContainers property of the shapes:

Sub test()
    Dim shp As Shape
   
    Set shp = ActiveWindow.Selection(1)
   
    Dim arCont As Variant
    Dim vCont As Variant
    arCont = shp.MemberOfContainers
   
    For Each vCont In arCont
        Set cont = ActivePage.Shapes.ItemFromID(vCont)
        Debug.Print cont.ID; cont.Text
    Next vCont
   
End Sub
Yacine

tepebox

THANKS, very much appreciated... I'll test that later today and give feedback!


Thomas

tepebox

Thanks again, after solving some issues with variable types I managed to integrate your code into my soluiton. Perfect stuff :-)