s_vibhav
March 13th, 2001, 02:33 AM
When I merge documents in MSWord-97 that contain comments (annotations), some of the merged comments may become mixed (scrambled) with other comments.
kindly suggest the solution to merge the documents perfectly or suggest any alternate way to accomplish the task.
Iouri
March 13th, 2001, 07:29 AM
Try this code
' Don't forget to add the "Microsoft Word 8.0 Object Library"
private Sub cmdButton_Click()
Dim objWord as Word.Application 'you can also declare it "as Object"
On error GoTo errorhandler
' create the word object (following code is VBA)
set objWord = CreateObject("Word.Application")
objWord.Visible = true 'not required
' merge the two files to one
objWord.Documents.Open FileName:="C:\FIRST.DOC"
objWord.Selection.EndKey Unit:=wdStory
objWord.Selection.InsertFile FileName:="C:\SECOND.DOC"
' save, close and exit
objWord.ActiveDocument.SaveAs "C:\BOTH.DOC"
objWord.ActiveDocument.Close
objWord.Quit
set objWord = nothing
'free the object
MsgBox "I am ready"
Exit Sub
errorhandler:
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
Iouri Boutchkine
iouri@hotsheet.com