怎样在word中删除关键字开头的所在段落

2025-03-09 23:02:26
推荐回答(3个)
回答1:

以“好”字开头为例
首先,编辑 → 替换
查找内容:[^11^13]好*[^11^13]
替 换 为:^p
高级 → √使用通配符 → 全部替换


ctrl+h弹出替换框——查找内容中输入”^p“——替换为内容中不输入——全部替换,如图:

回答2:

每道题的解析都是用[方括号]吗?每个题的解析都只有一段吗?
如果是这样,你可以试试按ctrl+F,在查找里输入 “[解析]*^p”,替换栏空着,点击下面的“高级”选项,在“使用通配符”前面的方框里打上对勾,点全部替换。
尝试以前请备份您的文件。

回答3:

百分百亲测有效!!

  1. Alt+F11 打开VBA EDITOR

  2. 点击左侧的normal

  3. 点击上方的插入选项, 选择 :模块

  4. 在打开的文本框中复制以下文字:

  5. Sub DeleteSentencesContainingSpecificWords()
      Dim strTexts As String
      Dim strButtonValue As String
     
      strTexts = InputBox("Enter texts to be found here: ")
     
      With Selection
        .HomeKey Unit:=wdStory
     
        '  Find the entered texts.
        With Selection.Find
          .ClearFormatting
          .Text = strTexts
          .Replacement.Text = ""
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchWildcards = False
          .MatchSoundsLike = False
          .MatchAllWordForms = False
          .Execute
        End With
     
        Do While .Find.Found = True
          '  Expand the selection to the entire sentence.
          Selection.Expand Unit:=wdSentence
          strButtonValue = MsgBox("Are you sure to delete the sentence?", vbYesNo)
          If strButtonValue = vbYes Then
            Selection.Delete
          End If
          .Collapse wdCollapseEnd
          .Find.Execute
        Loop
      End With
    End Sub
  6. 点击上方 “运行”,或者按F5

  7. 对话框中输入想删去段落包含的关键字

  8. 点击确认就好(坏处就是如果要删除的段落很多,要一个个确认,可以按Y键加快速度)