I have a word document with a lot of tables. I'd like to map each table to the immediate heading they are listed under. Right now I am thinking of passing through the selection cursor through each individual table and somehow find the immediate heading that the selection cursor is under. I am having trouble with finding the heading. I cannot find any documented member functions that can help me do this.
For Each T In wrdDoc.Tables
wrdApp.Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext
'Find heading
Next T
edit To clarify the formatting of the document:
1
Table 1 Table 2
1.1
Table 3
1.1.1
Table 4
1.2
Table 5
2
2.1
Table 6
Basically, there are multiple levels of headings. Under each, there may or may not be multiple tables. So in the case above, I'd like to figure out a way to map Tables 1 and 2 to 1, Table 3 to 1.1, Table 4 to 1.1.1 and etc..