使用范围

时间:2018-06-21 07:14:36

标签: vba range word-vba bulletedlist paragraph-marker

我需要删除ActiveDocument的所有段落标记,除了:

  1. 后面带有粗体的那个。 (示例在图片中,随附)

  2. 子弹头段落标记。

通过使用Ranges,我想到了以下代码。它运作良好,但未检测到要点。我该怎么办?我是初学者,可以使用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

插图: enter image description here

0 个答案:

没有答案