Merging of Documents 
Author Message
 Merging of Documents

I am building a program  which must merge all the word
document one after the other.All these documents will be
in the same format.

I am able to copy and paste the content of the first
document in the new one.After that the contents of all the
other documents in the folder are getting over written.The
contents of the other files are not getting appended to the
first document
To explain to you  .If there is a folder call test which
has 10 documents naming 1,2,3,4,5,6 up to 10 .I need to
merge all of them. in the sequential order with out change
in their formats.I am able to copy the content of 1 to the
new document.but the contents of the other documents
(2,3,4 etc) are not getting appended instead they are
getting over written.In the end the content of 10 is only
available not the consolidated content of 1 to 9.
Could some one help out to solve this problem

ragu



Sat, 05 Jun 2004 22:47:12 GMT  
 Merging of Documents
Hello,

I think you need to define the range, select the range, and then insert the
file at the selection if you want to add one document after the next to a
current document.  For example, you might use  the following:

Dim oRng As Range
Dim fn As String
For each document in a directory 'this is your loop or any way that you
select one document after the next
fn = "ChangeDocumentName"
Set oRng = ActiveDocument.Range _
    (Start:=ActiveDocument.Range.End - 1, _
    End:=ActiveDocument.Range.End - 1)
oRng.Select
Selection.TypeParagraph
Selection.InsertFile FileName:=fn, Range:=""
Next document ' get the next document to insert

HTH


Quote:
> I am building a program  which must merge all the word
> document one after the other.All these documents will be
> in the same format.

> I am able to copy and paste the content of the first
> document in the new one.After that the contents of all the
> other documents in the folder are getting over written.The
> contents of the other files are not getting appended to the
> first document
> To explain to you  .If there is a folder call test which
> has 10 documents naming 1,2,3,4,5,6 up to 10 .I need to
> merge all of them. in the sequential order with out change
> in their formats.I am able to copy the content of 1 to the
> new document.but the contents of the other documents
> (2,3,4 etc) are not getting appended instead they are
> getting over written.In the end the content of 10 is only
> available not the consolidated content of 1 to 9.
> Could some one help out to solve this problem

> ragu



Sun, 06 Jun 2004 02:59:49 GMT  
 Merging of Documents
Thanxs Mr.Dave.I tried your suggestion and it is working
fine

ragu

Quote:
>-----Original Message-----
>Hello,

>I think you need to define the range, select the range,
and then insert the
>file at the selection if you want to add one document
after the next to a
>current document.  For example, you might use  the
following:

>Dim oRng As Range
>Dim fn As String
>For each document in a directory 'this is your loop or
any way that you
>select one document after the next
>fn = "ChangeDocumentName"
>Set oRng = ActiveDocument.Range _
>    (Start:=ActiveDocument.Range.End - 1, _
>    End:=ActiveDocument.Range.End - 1)
>oRng.Select
>Selection.TypeParagraph
>Selection.InsertFile FileName:=fn, Range:=""
>Next document ' get the next document to insert

>HTH



>> I am building a program  which must merge all the word
>> document one after the other.All these documents will be
>> in the same format.

>> I am able to copy and paste the content of the first
>> document in the new one.After that the contents of all
the
>> other documents in the folder are getting over
written.The
>> contents of the other files are not getting appended to
the
>> first document
>> To explain to you  .If there is a folder call test which
>> has 10 documents naming 1,2,3,4,5,6 up to 10 .I need to
>> merge all of them. in the sequential order with out
change
>> in their formats.I am able to copy the content of 1 to
the
>> new document.but the contents of the other documents
>> (2,3,4 etc) are not getting appended instead they are
>> getting over written.In the end the content of 10 is
only
>> available not the consolidated content of 1 to 9.
>> Could some one help out to solve this problem

>> ragu

>.



Sun, 06 Jun 2004 13:16:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

2. Merging several documents into one

3. merging word documents into a table cell

4. Handling/merging multiple documents in Word 97

5. Merging two Documents

6. Help! Merge multiple documents with code

7. Finding Mail Merge Data Documents

8. merge 2 documents in VBA

9. How to merge 2 documents into 1

10. Merging Word documents from within VB5

11. Merging word documents from within VB5

12. How to merge two documents ?

 

 
Powered by phpBB® Forum Software