How can I merge twelve separate documents into a single document?

M

Murrumba

I have several chapters of a book written as separate documents. I would now
like to incorporate each document into a single document. How can this be
done, or is this not possible?

I am using Word 2007.
 
D

Doug Robbins - Word MVP

As this is probably just a one time operation, copying and pasting is
probably the simplest way.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
G

Graham Mayor

You could try the boiler add-in http://www.gmayor.com/Boiler.htm with the
option to set a section break between each document, but how successful it
will be will depend on the relative formatting of the individual documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
E

eliza sahoo

Following code snippet demonstrates how to do it in VB.NET
[VB.NET CODE STARTS]

'== Declare variables
Dim fileArray as new ArrayList
Dim intCount As Integer = 0

'== Create an object of WORD.

Dim objWord As Object
objWord = CreateObject("Word.Application") '

'== Loop through the collection of documents and add to main word document

For Each fi As System.IO.FileInfo In dirInfo.GetFiles("*.doc") ' dirInfo : is the directory where all the separate docs are saved

If Not fileArray.Contains(fi.FullName) Then ' Check if document is not already added.
If intCount = 0 Then
objWord.Documents.Add(fi.FullName) ' for the first document to be added use Documents.Add method
Else
objWord.Selection.InsertFile(filename:=fi.FullName, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False) ' next time onwards use InsertFile method
End If

objWord.Selection.EndKey(Unit:=6) ' set the control \ cursor to the end of the document to insert next in the new page
intCount += 1 ' increment count by 1
fiArr.Add(fi.FullName) ' add the merged document to the collection

End If

Next

'== Delete all separate documents from folder after merge

For Each fi As System.IO.FileInfo In dirInfo.GetFiles("*.doc")
fi.Delete()
Next

'== Make the main document visible

If Not objWord.Visible Then
objWord.Visible = True
End If





Murrumba wrote:

How can I merge twelve separate documents into a single document?
07-Mar-10

I have several chapters of a book written as separate documents. I would now
like to incorporate each document into a single document. How can this be
done, or is this not possible?

I am using Word 2007.

Previous Posts In This Thread:

How can I merge twelve separate documents into a single document?
I have several chapters of a book written as separate documents. I would now
like to incorporate each document into a single document. How can this be
done, or is this not possible?

I am using Word 2007.

As this is probably just a one time operation, copying and pasting isprobably
As this is probably just a one time operation, copying and pasting is
probably the simplest way.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

You could try the boiler add-in http://www.gmayor.com/Boiler.
You could try the boiler add-in http://www.gmayor.com/Boiler.htm with the
option to set a section break between each document, but how successful it
will be will depend on the relative formatting of the individual documents.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Submitted via EggHeadCafe - Software Developer Portal of Choice
Free Online Courses Available for Eggheadcafe.com Users
http://www.eggheadcafe.com/tutorial...8-fc3cf6855293/free-online-courses-avail.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top