Dim app As New MSWord.Application
try
Dim fileName = "d:\test.doc"
Dim doc = app.Documents.Open(fileName)
app.ActiveWindow.ActivePane.View.SeekView = app.Selection.wdSeekCurrentPageHeader
app.Selection.Find.Text = "BB"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "CCC"
app.Selection.Find.Execute(Replace:=MSWord.WdReplace.wdReplaceAll)
app.visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
' MessageBox.Show("OK:")
End try
[此贴子已经被作者于2021/11/30 21:55:04编辑过]