首页 > 解决方案 > .查找多次

问题描述

所以我需要做一个.Find,如果为真,则将值返回到一个单元格中,然后再做一个.Find。到目前为止,我为 Text1 工作,但随后为 Text2 返回 False。是否认为我需要以某种方式重置 .Found 值?

With wrdDoc
        With .Range.Find
        .MatchWholeWord = True
        .Text = "text1"
        .Execute
    If .Found = True Then
      Cells(resultRow, 1).Value = strFileName
        .MatchCase = False
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Text = "text2"
        .Execute
        If .Found = True Then
          MsgBox "This document contains the word2"

我对此有点陌生,所以我一定只是错过了一些关于 .Range.Find 的规则

标签: vbams-word

解决方案


推荐阅读