I have a bunch of word documents that use outlined, numbered headings each with an appropriately defined style.
The scope of this document is...
Throughout such a structured document, we have unique identifiers, such as: XXXX-123, XXXX-456.
A sample of how these appear is:
4.1 Part A
Some other para...
XXXX-123 Text for this identifier...
XXXX-456 Text for this other identifier.
5. Next section
5.1 Subsection A
XXXX-789 Text for this identifier.
Now, basically I want a macro that generates a table such as this:
Col1 - ID, Col2 - Section
XXXX-123, 4.1 Part A
XXXX-456, 4.1 Part A
XXXX-789, 5.1.1 Introduction
Note: page numbers are not really relevant - my goal is to keep track of the identifiers.
The pseudo code I have in my head is:
for each match (identifier expression) in document
get nearest heading
write identifier to col1
write heading to col2
Code should ideally work in Word 2003, Word 2010.