Selecting Specific text while keeping place in a document

K

kudruu

Hi,
I am writing a macro for a huge word document that will label certain
conditions (from about 1-2000) and will isolate the sections and
conditions of these conditions and place them into a neatly formatted
CSV file.
The document is in this kind of format:
*********
(bold)1.2.3.4 HEADER(/bold)

Here is a condition and a keyword[number] that is indexed.

Here is another condition and a keyword[number] that is indexed.

(bold)2.3.4.5 HEADER(/bold)

Here is a condition and a keyword [number] that is indexed.
********

The problem I am having is how to get word to first extract the number
before the header, then the header itself. I also don't know how to
look at each keyword and work backwards to find a carriage return
(another another keyword) and forward to the next period (or next
carriage return) in order to properly index a CSV file like this:
Index, keyword, Header Number, HEADER, Description

The keyword is always the same word and only indicates a numbered
condition.
Right now my macro will label all of the keywords but it will not find
headers, numbers, or extract the descriptions.
Any help would be greatly appreciated,
Thanks!
 
G

Graham Mayor

You should look at http://www.gmayor.com/replace_using_wildcards.htm which
demonstrates how to identify strings and how to manipulate them.

If you want more direct help you need to post a sample of the document
(change any names if commercially sensitive) with sufficient sections to
show any variations and an exact example of the result you expect to
achieve.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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