Dim app As New MSWord.Application
try
Dim doc0 As Object = app.Documents.Open("d:\test2.doc")
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekCurrentPageHeader
app.ActiveWindow.Selection.WholeStory
app.ActiveWindow.Selection.Copy
app.ActiveWindow.ActivePane.View.SeekView = MSWord.WdSeekView.wdSeekMainDocument
Doc0.Close
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
app.ActiveWindow.Selection.TypeBackspace
app.ActiveWindow.Selection.Paste
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