Section heading information

M

Michael Larsen

Hello All

I am attempting to extract some information from a word document and
place it in either excel or a database. The information I am trying
to extract is the section heading numbers for instance:

1 Heading Style 1

1.1 Heading Style 2

1.1.1 Heading Style 3

I am attempting to find the paragraphs with Heading Style 1 and
extract the associate List Number. Ideally when I finished extracting
the information secition heading and text I would have something that
would look like a table of contents, but the list would be far more
complete because it would also contain any outlined lists from the
document.

Does anyone know how to extract the ouline or list reference for a
specific heading style or list?
 
J

Jezebel

A quick way to do this is to display the document in Outline view, select
the heading level you're interested in, copy, and paste into Excel. Then use
the Excel's data methods to split each item into list number and text.

If you want to do it all via VBA, there are any number of methods. Probably
the simplest is to iterate the paragraphs of the document and in each case
examine: a) the Outline level -- 1 for heading 1, 2 for heading 2, etc -- ,
and b) the ListString property of the paragraph.Range.ListFormat -- these
are the list numbers, 1, 1.1, 1.1.1 in the example you give.
 

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