PDA

View Full Version : Solved: Extracting Outline Numbers from a paragraph



MWE
05-26-2008, 02:13 PM
Assume a outline numbered couple of paragraphs, for example

1.1 Some 2nd level title


1.1.1 3rd level text

1.1.2 additional 3rd level text


How do I "extract" using VBA the outline number for a given paragraph. I looked through the Object Browser and found some interesting things, but did not find the outline number.

Thanks

gwkenny
05-26-2008, 08:27 PM
REF fieldcode should do it but I almost always use STYLEREF.

Checkout the /n flag for STYLEREF and I think you'll have all you need.

gwkenny
05-26-2008, 08:47 PM
Heh, just realized you wanted the list numbers in vba code and not with a field reference in the document! lol

Take a look at .ListFormat.ListLevelNumber and .ListFormat.ListValue

That should do ya

MWE
05-27-2008, 05:09 AM
Heh, just realized you wanted the list numbers in vba code and not with a field reference in the document! lol

Take a look at .ListFormat.ListLevelNumber and .ListFormat.ListValue

That should do yaThanks for the prompt reply.

The two ListFormat methods you provided did not quite do what I wanted, but you provided the key with "ListFormat".

.ListFormat.ListString provides the complete "text" for the numbering scheme, e.g., "1.2.3" for the para
1.2.3 this is 3rd level text

gwkenny
05-27-2008, 08:54 AM
I try to be, but can't be a mind reader :)

I have no context. I gave you the parts, you wanted the whole.

Just glad you got what you needed :)

Good luck!