下面是一个示例代码,可以实现在多个 Word 文档中替换文字的功能:
Sub ReplaceTextInMultipleDocs()
Dim strOldText As String
Dim strNewText As String
Dim strPath As String
Dim strFile As String
Dim wdDoc As Document
strOldText = InputBox("请输入需要替换的旧文字:")
strNewText = InputBox("请输入替换成的新文字:")
strPath = InputBox("请输入文件夹路径:")
st