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.
Jezebel - 29 Jun 2005 01:55 GMT
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).
>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,
[quoted text clipped - 8 lines]
> can
> find automatic numbering. Any help would be greatly appreciated.
Klaus Linke - 29 Jun 2005 02:14 GMT
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
>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,
[quoted text clipped - 8 lines]
> can
> find automatic numbering. Any help would be greatly appreciated.
Kurtis - 29 Jun 2005 17:47 GMT
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
> Hi Kurtis,
>
[quoted text clipped - 35 lines]
> > can
> > find automatic numbering. Any help would be greatly appreciated.