Consulting

Results 1 to 5 of 5

Thread: Extract Lines with bullet points / number

  1. #1

    Extract Lines with bullet points / number

    Hi all,

    My document has the content like:

    1. ***
    *********XX
    *********XX
    2. ***XX ***
    *********XX
    3. XX
    ***
    ● ******
    ***X
    ***X ***X ***X
    4. ***
    ***X
    ● ******


    My concern is how to extract only numbered / bulleted line

    The outcome would be :

    1. ***
    2. ***XX ***
    3. XX
    ● ******
    4. ***
    ● ******

    Thanks !

  2. #2
    Are the bullets/numbers simply text or are they inserted using bullets and numbering?
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    They are inserted bullets.

  4. #4
    In that case the following should work

    Sub Macro1()
    Dim oDoc As Document
    Dim oTarget As Document
    Dim oPara As Paragraph
    Dim oRng As Range
    Dim strStyle As String
        Set oDoc = ActiveDocument
        Set oTarget = Documents.Add
        For Each oPara In oDoc.Paragraphs
            strStyle = oPara.Style
            If strStyle Like "List*" Then
                Set oRng = oTarget.Paragraphs.Last.Range
                oRng.FormattedText = oPara.Range.FormattedText
            End If
        Next oPara
    lbl_Exit:
        Set oPara = Nothing
        Set oDoc = Nothing
        Set oTarget = Nothing
        Set oRng = Nothing
        Exit Sub
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  5. #5
    Thanks man!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •