Solved

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

Posted on 2012-03-26
2
412 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

730 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