• Finding Bullets and numbers (Word 2002 SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Finding Bullets and numbers (Word 2002 SP2)

    Author
    Topic
    #396634

    Hi
    I’m trying to find paragraphs that are formatted as bullets or numbered lists (generically).

    If I’ve formatted a list by clicking the toolbar bullet button it seems to apply a dynamic style that cannot be searched for as one of the inbuilt styles using Edit > Replace > More > Format > Style. Am I missing something? confused

    Assuming it cannot, is there a segment of VBA that would allow me to effectively replace bullets with themselves less the bullet character? (I’m trying to feed a word document into a foreign system that chokes on bullets).

    Thanks in advance grin

    Viewing 5 reply threads
    Author
    Replies
    • #744802

      You can test whether a paragraph is bulleted by checking its .Range.ListFormat.ListType property. This is wdListNoNumbering (=0) for a non-bulleted, non-numbered paragraph, non-zero if any kind of numbering or bullets has been applied, for example wdListBullet (=2) for simple bullets and wdListPictureBullet (=6) for picture bullets.

      You can turn off all numbering and bullets in one fell swoop by running

      ActiveDocument.RemoveNumbers

      Or you can loop through the paragraphs and turn off bullets individually:

      Dim par As Paragraph
      For Each par in ActiveDocument.Paragraphs
      Select Case par.Range.ListFormat.ListType
      Case wdListBullet, wdListPictureBullet
      par.Range.ListFormat.RemoveNumbers
      Case Else
      ‘ do nothing
      End Select
      Next par
      Set par = Nothing

      • #745192

        HansV

        Thanks heaps – that should do the trick nicely. Once again I am in awe of the expertise. salute

      • #745193

        HansV

        Thanks heaps – that should do the trick nicely. Once again I am in awe of the expertise. salute

    • #744803

      You can test whether a paragraph is bulleted by checking its .Range.ListFormat.ListType property. This is wdListNoNumbering (=0) for a non-bulleted, non-numbered paragraph, non-zero if any kind of numbering or bullets has been applied, for example wdListBullet (=2) for simple bullets and wdListPictureBullet (=6) for picture bullets.

      You can turn off all numbering and bullets in one fell swoop by running

      ActiveDocument.RemoveNumbers

      Or you can loop through the paragraphs and turn off bullets individually:

      Dim par As Paragraph
      For Each par in ActiveDocument.Paragraphs
      Select Case par.Range.ListFormat.ListType
      Case wdListBullet, wdListPictureBullet
      par.Range.ListFormat.RemoveNumbers
      Case Else
      ‘ do nothing
      End Select
      Next par
      Set par = Nothing

    • #745232

      Do you need the bullets and numbers to remain but act as if typed at the start of the paragraph rather than an automatic element? If this is the case then a macro like the following might be useful.

      Sub NumberingAutoToHardcoded()
      'converts autonumbers to hard coded
        Dim iResp As Integer
        iResp = MsgBox("This macro converts automatic paragraph numbers to hard coded." _
          & vbCr & "Click Yes to convert the entire document." & vbCr & _
          "Click No to convert only the selected paragraphs." & vbCr & _
          "Click Cancel to stop the macro.", _
          vbYesNoCancel, "Delete Hard Numbers")
        If iResp = vbYes Then
          ActiveDocument.ConvertNumbersToText (wdNumberAllNumbers)
        ElseIf iResp = vbNo Then
          Selection.Range.ListFormat.ConvertNumbersToText (wdNumberAllNumbers)
        End If
      End Sub
    • #745233

      Do you need the bullets and numbers to remain but act as if typed at the start of the paragraph rather than an automatic element? If this is the case then a macro like the following might be useful.

      Sub NumberingAutoToHardcoded()
      'converts autonumbers to hard coded
        Dim iResp As Integer
        iResp = MsgBox("This macro converts automatic paragraph numbers to hard coded." _
          & vbCr & "Click Yes to convert the entire document." & vbCr & _
          "Click No to convert only the selected paragraphs." & vbCr & _
          "Click Cancel to stop the macro.", _
          vbYesNoCancel, "Delete Hard Numbers")
        If iResp = vbYes Then
          ActiveDocument.ConvertNumbersToText (wdNumberAllNumbers)
        ElseIf iResp = vbNo Then
          Selection.Range.ListFormat.ConvertNumbersToText (wdNumberAllNumbers)
        End If
      End Sub
    • #745655

      Hi Andrew:
      Just to correct something that might be a misapprehension, attaching bullets or numbering to a list does not apply a style, dynamic or otherwise. You can link bullets or numbering to a style & then search for that style using Find/Replace. But the results of your search will to be find that style, regardless of whether you’ve removed or kepts the bullets.

      e.g. create style called “New” & apply it to a paragraph. Now attach a bulleted list template to it. You should now be able to put the cursor in another paragraph, click Bullets & Numbering, apply the particular bulleted scheme, & the style will also change to “New”. You can use Edit/Find to search for all occurences of the “New” style. However, if you remove the bullets from a paragraph, the “New” style will remain. I hope this clarifies, more than confuses. smile

    • #745656

      Hi Andrew:
      Just to correct something that might be a misapprehension, attaching bullets or numbering to a list does not apply a style, dynamic or otherwise. You can link bullets or numbering to a style & then search for that style using Find/Replace. But the results of your search will to be find that style, regardless of whether you’ve removed or kepts the bullets.

      e.g. create style called “New” & apply it to a paragraph. Now attach a bulleted list template to it. You should now be able to put the cursor in another paragraph, click Bullets & Numbering, apply the particular bulleted scheme, & the style will also change to “New”. You can use Edit/Find to search for all occurences of the “New” style. However, if you remove the bullets from a paragraph, the “New” style will remain. I hope this clarifies, more than confuses. smile

    Viewing 5 reply threads
    Reply To: Finding Bullets and numbers (Word 2002 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: