Solved

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

Posted on 2012-03-26
2
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 …

724 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