Help! Merge multiple documents with code 
Author Message
 Help! Merge multiple documents with code

I inherited a routine that creates a series of merged word documents in Wp
and am moving it to Word 2000.  These docuements need to be repaginated so
that I don't end up with doc1 1 of 4, doc2 1 of 6 etc...
The only problem I have is appending the next document to the END of the
previous document and I'm sure it is just a matter of the right command
syntax but I'm stuck... Code follows with error location commented.
The paste always pastes over the top of the previously pasted document so I
end up with only the last document showing in the result.
'**********Code Start**********
Dim mrgDocs() As Document

Public Function BldDocArray() As Boolean
Dim tmpDoc As Document
Dim i As Integer
Dim docRange As Range
Dim tmpRange As Range

    With Application.Documents

    ReDim Preserve mrgDocs(0 To .Count)

        For i = 1 To .Count

            If Left(.Item(i).Name, 12) = "Form Letters" Then
                Debug.Print .Item(i).Name
                Set mrgDocs(CInt(Right(.Item(i).Name, 1))) = .Item(i)
            End If
        Next i

  Set tmpDoc = .Add
  Set tmpRange = tmpDoc.Range
   For i = 1 To UBound(mrgDocs()) - 1
      Debug.Print i & " " & mrgDocs(i).Name
            Set docRange = mrgDocs(i).Range

'    <Problem is here!!!
'    <Paste replaces previous selection!


Next i

   tmpDoc.ActiveWindow.Visible = True
End With
End Function

Mon, 29 Sep 2003 20:38:28 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Handling/merging multiple documents in Word 97

2. Multiple merge documents appened and repaginated

3. Multiple document merge

4. Merge Multiple Docs against Multiple Records in Datasource

5. (Q211727) Mail merge document restored to normal document - Word 2000

6. Opening Merge Document tries to remerge the document

7. (Access/Word Merge) Automating Closing of Main Doc Containing Merge Codes

8. Help: Merging pages from 2 documents.

9. newbie needs code help for word mail merge

10. help with vb code for e-mail;merging and editing 2 fields into body of message

11. Print a word document built from multiple sub documents using the RD tag

12. NEED HELP, Coding Access to Word Mail Merge :-)


Powered by phpBB® Forum Software