Resequencing Paragraph Outline Numbering

H

hagentd

Hello Everyone,

I'm trying to automate a task. I want the user to select the original
text (example below), execute the macro and convert it to what looks
like in the reformatted example. The assumptions is that there will
never be more than 30 entries for any level of outline numbering. The
text is all plain text as well and all the paragraphs have no styles
associated with them. I've tried coding finding and replacing using
loops but was getting hung up on keeping the numbering together. Any
easy ideas on how to do this?

Original Text:
1. First Paragraph.
a. Sales Plan.
b. Strategy.
(1) Strategy 1.
(2) Strategy 2.
(3) Strategy 3.
c. Marketing Plan.
2. Second Paragraph.
a. Intent
b. Concept of Execution.
(1) Execution 1.
(2) Execution 2.
(3) Execution 3.

Reformatted Text:
1. First Paragraph.
1.a. Sales Plan.
1.b. Strategy.
1.b.(1) Strategy 1.
1.b.(2) Strategy 2.
1.b.(3) Strategy 3.
1.c. Marketing Plan.
2. Second Paragraph.
2.a. Intent
2.b. Concept of Execution.
2.b.(1) Execution 1.
2.b.(2) Execution 2.
2.b.(3) Execution 3.

Thanks for the help!
Terry Hagen
 
C

Cindy M -WordMVP-

Hi (e-mail address removed),
'm trying to automate a task. I want the user to select the original
text (example below), execute the macro and convert it to what looks
like in the reformatted example. The assumptions is that there will
never be more than 30 entries for any level of outline numbering. The
text is all plain text as well and all the paragraphs have no styles
associated with them. I've tried coding finding and replacing using
loops but was getting hung up on keeping the numbering together. Any
easy ideas on how to do this?
Has the numbering been typed in manually, or generated using Words
AutoNumbering feature? And which version of Word?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
H

hagentd

Hi Cindy,

It has been typed in manually in plain text so there are no styles
associated with it. I'm working in Word 2k.

Thanks!
Terry
 
K

Klaus Linke

Hi Cindy,

It has been typed in manually in plain text so there are no styles
associated with it. I'm working in Word 2k.


Hi Terry,

Find/Replace then would be pretty clumsy. You'd be better off with a loop
over all paragraphs
Dim paraLoop as Paragraph
For each paraLoop in ActiveDocument.Paragraphs
' ...
Next paraLoop

For each para, you'd try to detect a level 1, 2, or 3 number at the
beginning (perhaps using "Like").
You'd stow a detected number in one of three variables (one for each level),
and then replace the old short number with the new long number in level 2
and 3 paragraphs.

The whole thing might turn out rather simple if you have tabs after all the
numbers. If there aren't tabs, it might make sense to put them in first.
This could be done with wildcard replacements, say for level 3:
Find what: (^13\([0-9]\))[^32^s^t]{1,}
Replace with: \1^t

If you run into problems, post back!

Regards,
Klaus
 

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