Link to home
Start Free TrialLog in
Avatar of MrDavidThorn
MrDavidThorn

asked on

Word VBA select shape within a shape

Hi Experts

I have a shape in Word, within that shape is another shape, and within that second shape is a table,  using VBA I can select the first shape, but I cant select the second shape and thus I cant select the table, any ideas?
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

I think that we need more details.

What sort of shapes are you using, and in what way is one within the other?
What is the code that that you are trying?

Ideally, could post the (relevant part of) the document?
Avatar of MrDavidThorn
MrDavidThorn

ASKER

I have attached an example file,  - there are two charts, each chart is in a table, each table is in a shape and both frames are in a 'Master shape'

If I use the vba below I can interogate the shape.

Activedocument.shapes(1)

What I want to do is return with a msgbox the table title  -i.e with the sample provided return the word 'Example'

I would expect the code to be similar to:

With  Activedocument.shapes(1)
          msgbox .TextFrame.TextRange.shapes(1).tables(1).cells(1,1).range.text
End with

However the above code is not valid.
example.docx
aha, Iv found that the two shapes "within the shape" has actually created by grouping the shapes together, Is there a way for VBA to interogate grouped shapes?
ASKER CERTIFIED SOLUTION
Avatar of MrDavidThorn
MrDavidThorn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry. I got diverted before seeing your document.

Well done. Yes, Shapes can be grouped so that they are treated as one item. This is helpful if you want them to stay together when repositioning them.
the am de best