|
-
March 13th, 2001, 03:33 AM
#1
VBA
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.
-
March 13th, 2001, 08:29 AM
#2
Re: VBA
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
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|