老师,您好:
之前的问题中找到了如下代码,想把 页眉中的 “[列名]” 替换为 "编号123”,该如何修改如下代码?
另,标黄的msgbox没有执行。
谢谢!
Dim app As New MSWord.Application
try
Dim fileName = "d:\test.doc"
Dim doc As Object = app.Documents.Open(fileName)
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageHeader
app.ActiveWindow.Selection.WholeStory
If app.ActiveWindow.Selection.Find.Execute("[列名]") Then
msgbox("[列名]")
app.ActiveWindow.Selection.TypeText(Text:="编号123")
End If
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
app.Visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
'app.Quit
End try