Delete all Paragraph Marks except bullets, using Range

浪尽此生 提交于 2019-12-10 12:16:22

问题


I need to delete all paragraph marks of ActiveDocument except:

  1. The one which is having Bold-Font after. (Example is in picture, attached)

  2. Bullet-Point paragraph marks.

By using Ranges I came up with the following Code. It works well, but it is not detecting the bullet points. What should I do? I am beginner to use Ranges.

Sub PARAGRAPHSmark()
Dim PARA As Range
Dim p   As Range
Set PARA = ActiveDocument.Range
PARA.MoveEnd wdCharacter, -1
Do
Set p = PARA.Duplicate
p.Find.Execute "^13"
 PARA.Start = p.End
If p.Find.Found Then
    p.MoveEnd wdCharacter, 1
    If p.Bold = False Then
    p.MoveEnd wdCharacter, -1

    ' This `If` condition is not detecting bullet when actually its  there.
       If p.ListFormat.ListType = wdListListNumOnly Or p.ListFormat.ListType = wdListSimpleNumbering Or p.ListFormat.ListType = wdListBullet Then

        Else
        p.Delete
        p.InsertAfter " "
        End If
    Else
    End If
Else
Exit Do
End If
Loop

End Sub

Illustration:

来源:https://stackoverflow.com/questions/50962517/delete-all-paragraph-marks-except-bullets-using-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!