Solved

List Numbers in Word Documents, extracting them in VB.NET

Posted on 2012-03-26
2
392 Views
Last Modified: 2012-03-27
in a Word document with a standard numbering list, all of the objects I use to extract info from the document return the text but fail to return the actual numbering.  example:

1.1 abc
1.1.2 def
1.1.3 ghi

i'd like to be able to return "1.1 abc" and "1.1.2 def" but I can only figure out how to return "abc" and "def"

there doesn't seem to be an object or method for this.  i've tried Paragraphs and Lists and ListFormat, but haven't succeeded with any of those.
0
Comment
Question by:RBECKMN
2 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 37769637
You'll have to go through the .Paragraphs collection looking for those paragraphs with a .ListFormat and read the .ListString.

The syntax is something like:  ActiveDocument.Paragraphs(n).Range.ListFormat.ListString.

or something I just tested, like:

Sub checkDocument()
Dim r As Word.Range
Dim p As Word.Paragraph

    For Each p In ActiveDocument.Paragraphs
        Debug.Print p.Range.ListFormat.ListString, p.Range.Text
    Next p
End Sub

Open in new window

0
 

Author Closing Comment

by:RBECKMN
ID: 37770973
works great, thanks.  there is another solution to this problem posted elsewhere that also works, but this one is more direct.,
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now