Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding Bullets and numbers (Word 2002 SP2)

    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? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    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 <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Finding Bullets and numbers (Word 2002 SP2)

    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

  3. #3
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Bullets and numbers (Word 2002 SP2)

    HansV

    Thanks heaps - that should do the trick nicely. Once again I am in awe of the expertise. <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Finding Bullets and numbers (Word 2002 SP2)

    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.
    <pre>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</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding Bullets and numbers (Word 2002 SP2)

    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. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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