Thread: [Solved] Pull all lists from document
View Single Post
 
Old 02-01-2024, 01:59 PM
tonykekw tonykekw is offline Windows 11 Office 2021
Novice
 
Join Date: Jan 2024
Posts: 13
tonykekw is on a distinguished road
Default

"I'll start by asking what is the point of this activity? What is a collection of the list items in Excel going to do for you?"

The point of the activity is to find and organize a bunch of rules that are scattered across the document. Over the span of multiple documents. Having the data on excel was a suggestion. It is not a requirement. To me having the data on a sheet would feel more organized.

It doesn't matter if the data pulled is not by how the paragraphs appear in the document. Pulling the lists themselves would be enough. I am trying to essentially rebuild to pull and rebuild the documents.

Adding an Index is a great idea, having new ideas helps a lot.

I am assuming I would drop the
Code:
With aRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = ""
        .Forward = True
        Do While .Execute
            aRng.Start = aRng.Paragraphs(1).Range.Start
Something like this:
Code:
Sub PrintListParagraphsInfo()
    Dim aLP As Paragraph
    Dim aDoc As Document
    Set aDoc = ActiveDocument
    Debug.Print "Total List Paragraphs: " & aDoc.ListParagraphs.Count
    For Each aLP In aDoc.ListParagraphs
        aLP.Range.Select
        With aLP.Range.ListFormat
            Debug.Print "List Type: " & .ListType
            Debug.Print "List String: " & .ListString
            Debug.Print "Text: " & aLP.Range.Text
        End With
    Next aLP
End Sub
Reply With Quote