我想用新字符串替换所有三个字母的单词。MsgBox 显示变量threeLetterWord 有新值,但文本不变。
Sub ShowThreeLetterWords()
Set threeLetterRegExp = New RegExp
threeLetterRegExp.Pattern = "\b[a-zA-Z]{3}\b"
threeLetterRegExp.Global = True
Dim threeLetterWords As MatchCollection
Set threeLetterWords = threeLetterRegExp.Execute(ActiveDocument.Range)
For Each threeLetterWord In threeLetterWords
threeLetterWord = threeLetterRegExp.Replace(threeLetterWord, "sasa")
MsgBox threeLetterWord
Next threeLetterWord
End Sub