find automatic numbering macro

K

Kurtis

I created a macro that finds various manual numbering in the document,
deletes it, and depending on the location of the number from the margin,
applies a heading 1-5 style.

The problem I'm having is finding current automatic numbering in the
document, so I can replace it with it a Heading style. On occasion, a user
may start to apply auto numbering and give up. I know there isn't a way to
do a find and replace but I'm wondering if anyone knows of a macro that can
find automatic numbering. Any help would be greatly appreciated.
 
J

Jezebel

Iterate the paragraphs, examining the properties of the ListFormat object in
each case. Eg, the ListString property, which shows whatever is actually
displayed as the automatic number (nothing if not numbered).
 
K

Klaus Linke

Hi Kurtis,

This should do for a start:

? myParagraphRange.ListFormat.ListType

It'll return
1 (wdListListNumOnly) for ListNum fields,
2 (wdListBullet) for bullets,
3 (wdListSimpleNumbering) for simple numbering,
4 (wdListOutlineNumbering) for outline numbering and (the new) list styles,
5 (wdListMixedNumbering) for some mixture of the above.

Don't know what wdListMixedNumbering means, exactly. The only case I could
imagine (ListNum field plus some other auto-numbering) always gives me 1
(wdListNumOnly), which seems wrong.

For the actual text ("1.1." ...) that appears, you can use

? myParagraphRange.ListFormat.ListString

The VBA help should answer most of your questions, also, the
www.word.mvps.org FAQs have an article on ListString.

Regards,
Klaus
 
K

Kurtis

That was what I was missing. After going through the Listformat commands I
found the following, which does exactly what I need it to. Thank you very
much:

Selection.Range.ListFormat.ConvertNumbersToText
 
M

Maperalia

Kurtis;
It is possible if you can share your macro to run automatic numbering?. I
will really appreciate it.

Thanks in advance.
Maperalia
 

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