List numbering problem

T

Ted Fisher

My boss is a chucklehead. He frequently creates documents
with manually numbered paragraphs. Then he wants to
delete and insert paragraphs and have the numbering
automatically update. Is there a macro available to solve
this problem? Does anybody have a fix?
 
A

Alan

Hi Ted:

You may be able to do this, with find and replace, if the
numbering followed a certain pattern. For instance, if
all the numbered paragraphs had a particular unique style
that makes it easy.

The general idea is you replace
manual number tab character (if a certain style)
with
text substitute (eg, [nummm]) tab character

Then you create a field-based number -- for instance,
Insert / Field / click on AutoNumLgl and OK
Then Cut that number, and do:
[nummm]
becomes
Special / Clipboard Contents (which displays as ^c)
Replace All

You now have a field-based list. To freeze those numbers
back to manual, select the whole document and do
Ctrl+Shift+F9.
* * *
Now: backing up a little, what I mean by
replacing "manual number" is, if the format is 1. 2. etc.,
you do a Wildcard search for [0-9]{1,3}.
This finds 1- to 3-digit numbers followed by a period.
Add in a tab character if all the numbers had that format:
[0-9]{1,3}.^t

Let's say you don't have unique styles for those
paragraphs. You can still find the numbers if they start
paragraphs (which means, they follow paragraph marks) and
these are the only numbers like this in the document.

In a Wildcard search, you use ^13 in the top slot to say
paragraph mark, and ^p in the bottom (don't ask why).

So you can do:
^13[0-9]{1,3}.^t
becomes
^p[nummm].^t
 
A

Alan

Hi Ted:

This is just to clarify my other post. The first search,
to replace manual numbers with a text substitute, is a
Wildcard search.

Then, to replace the text substitutes with the clipboard
contents, that's a regular search and replace --
UNcheck "Use Wildcards."
 
B

Bruce Brown

Ted - This macro goes down every paragraph you select and removes
*everything* before the first letter in the paragraph, then applies a
numbering style to the paragraph. If the paragraph starts with
anything but a letter, don't include it in the selection; do it by
hand.

Where it says . . .

P.Range.Style = "List Number"

.. . . you can use any numbered style you want, like "Heading 3", etc.

Sub NumberSelectedParas()
If Selection.Type = wdSelectionIP Then
MsgBox "Quitting.", , "Nothing Selected"
Exit Sub
End If
Application.ScreenUpdating = False
Dim P As Paragraph, R As Range, All As Range
Set All = Selection.Range.Duplicate
For Each P In All.Paragraphs
Set R = P.Range
R.End = R.Start
R.MoveEndUntil "ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxyz"
R.Text = ""
P.Range.Style = "List Number"
Next
All.Select
End Sub

Is the word "chucklehead" in common usage? Great word, first time I'd
seen it.

- Bruce


Alan said:
Hi Ted:

You may be able to do this, with find and replace, if the
numbering followed a certain pattern. For instance, if
all the numbered paragraphs had a particular unique style
that makes it easy.

The general idea is you replace
manual number tab character (if a certain style)
with
text substitute (eg, [nummm]) tab character

Then you create a field-based number -- for instance,
Insert / Field / click on AutoNumLgl and OK
Then Cut that number, and do:
[nummm]
becomes
Special / Clipboard Contents (which displays as ^c)
Replace All

You now have a field-based list. To freeze those numbers
back to manual, select the whole document and do
Ctrl+Shift+F9.
* * *
Now: backing up a little, what I mean by
replacing "manual number" is, if the format is 1. 2. etc.,
you do a Wildcard search for [0-9]{1,3}.
This finds 1- to 3-digit numbers followed by a period.
Add in a tab character if all the numbers had that format:
[0-9]{1,3}.^t

Let's say you don't have unique styles for those
paragraphs. You can still find the numbers if they start
paragraphs (which means, they follow paragraph marks) and
these are the only numbers like this in the document.

In a Wildcard search, you use ^13 in the top slot to say
paragraph mark, and ^p in the bottom (don't ask why).

So you can do:
^13[0-9]{1,3}.^t
becomes
^p[nummm].^t
-----Original Message-----
My boss is a chucklehead. He frequently creates documents
with manually numbered paragraphs. Then he wants to
delete and insert paragraphs and have the numbering
automatically update. Is there a macro available to solve
this problem? Does anybody have a fix?


.
 

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