search for tables w/i a table

A

adgorn

I have a big table, and w/i some cells are little tables. I need to search
for each of those little tables. The table browse object won't do it.

What I am ultimately trying to do is extract each of the little tables (to
modify them separately), tag them with some identifier, leave behind a
placeholder, then be able to put them back when I'd done manipulating them.

I'd be happy if I could just cycle through all the tables first.
 
H

Helmut Weber

Hi,

I would not rely on something recursive, like tables in tables,
as long as the limit for the recursiveness is unknown.

Sub Test444()
Dim oTbl As Table
Dim oCll As Cell
For Each oTbl In ActiveDocument.Tables
For Each oCll In oTbl.Range.Cells
If oCll.Tables.Count > 0 Then
oCll.Tables(1).Select
Stop
End If
Next
Next
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
T

Tony Jollans

Tables form a hierarchy within a document, so in VBA you can do this:

For Each t In ActiveDocument.Tables(1).Tables
t.Select
Next

You need to have a way of identifying the outer table but then you can do
what you want with the inner ones.
 

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