|
请教各位,我手头有以下代码,用来批量替换一个Excel列表中的单词。这段代码在Word的正文部分运行良好,但是完全不影响页眉和页脚中的文字。有什么办法可以让这段代码查找和替换Word脚注里的文字吗?
- Sub Replace()
- Dim ex As Excel.Application, boo As Excel.Workbook, shee As Worksheet, i As Integer
- Set ex = New Excel.Application
- Set boo = ex.Workbooks.Open("C:\replace.xlsx")
- ex.Visible = False
- Set shee = boo.Worksheets(1)
- With shee
- For i = 1 To .Range("b65536").End(xlUp).Row
- ActiveDocument.Content.Find.Execute MatchWholeWord:=True, findText:=.Range("a" & i), replacewith:=.Range("b" & i), Replace:=wdReplaceAll, Forward:=True
- Next
- End With
- boo.Close
- ex.Quit
- Set boo = Nothing
- Set ex = Nothing
- End Sub
复制代码
|
|