wordvba 中的MatchWholeWord
MatchWholeWord是Word VBA中的一个属性,用于指定是否要在查找时仅匹配整个单词。如果设置为True,则只会匹配整个单词,否则将匹配包含该单词的任何字符串。以下是一个示例:
Sub FindWholeWord()
With ActiveDocument.Content.Find
.ClearFormatting
.Text = "hello"
.MatchWholeWord = True '只匹配整个单词
.Execute
End With
End Sub
在上面的代码中,我们将MatchWholeWord属性设置为True,因此只会匹配单独的“hello”单词,而不是包含“hello”的任何字符串。
原文地址: https://www.cveoy.top/t/topic/eRhq 著作权归作者所有。请勿转载和采集!