word vba 删除段首包含的关键词

180it 2019-09-25 PM 2519℃ 0条

Sub 删除段首包含的关键词()

  Dim i As Paragraph, n As Long
  Application.ScreenUpdating = False '关闭屏幕刷新
  For Each i In ActiveDocument.Paragraphs '在活动文档的段落集合中循环
       For n = 1 To i.Range.Characters.Count
           If i.Range.Characters(1).Text = "一、" _
           Or i.Range.Characters(1).Text = "二、" Then
              i.Range.Characters(1).Delete
           Else: Exit For
           End If
        Next n
   Next
  Application.ScreenUpdating = True '恢复屏幕刷新

End Sub

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

word vba 删除段首包含的关键词