Multiple merge documents appened and repaginated 
Author Message
 Multiple merge documents appened and repaginated

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.

'**********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
               docRange.WholeStory
               docRange.Copy

            tmpDoc.Activate
'    <Problem is here!!!
'    <Paste replaces previous selection!

    tmpDoc.Content.PasteSpecial

Next i

   tmpDoc.ActiveWindow.Visible = True
End With
End Function



Sun, 28 Sep 2003 23:06:47 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Handling/merging multiple documents in Word 97

2. Help! Merge multiple documents with code

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. Print a word document built from multiple sub documents using the RD tag

8. Can structures be appened to ArrayLists?

9. e-mail from Access via does not send merged Word document

10. Multiple records in a mail merge?

11. Merging a word97 document from Access form

12. Merging Documents

 

 
Powered by phpBB® Forum Software