Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ronald Roberts Ronald Roberts is offline
external usenet poster
 
Posts: 6
Default Merge multiple files into one

How can I merge multiple Word document files
into one file?

Do I need to write a macro t do this?

Thanks in advance.
Ron

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Merge multiple files into one

You can use Insert | File. If you want to preserve a link to the
original file, after selecting the file to insert, click the arrow
next to the Insert button and choose to "Insert as Link." This places
an INCLUDETEXT file in the target document; to update this field after
you've made changes to the original document(s), you can select the
entire document and press F9.

--
Stefan Blom
Microsoft Word MVP


"Ronald Roberts" wrote in message
...
How can I merge multiple Word document files
into one file?

Do I need to write a macro t do this?

Thanks in advance.
Ron





  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Ronald Roberts Ronald Roberts is offline
external usenet poster
 
Posts: 6
Default Merge multiple files into one

Stefan Blom wrote:
You can use Insert | File. If you want to preserve a link to the
original file, after selecting the file to insert, click the arrow
next to the Insert button and choose to "Insert as Link." This places
an INCLUDETEXT file in the target document; to update this field after
you've made changes to the original document(s), you can select the
entire document and press F9.


Stefan,

Thanks for the help. The file insert works the way I want, but there
are a couple of problems. I'm using sample data of 7 documents, Lesson
1.doc thru Lesson 7.doc. When I select all of the files using the shift
key, Word inserts all of the documents into one new blank document.
The problem I'm having is, they are inserted in the wrong order. the
order they are inserted is Lesson 7, 1, 2, 3, 4, 5, 6. Also there is no
page break between the documents. This works the same for Insert or
Insert Link.

What I did last night was record a macro and then add code around it for
what I needed. Here is the code:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/25/2006 by Ronald W. Roberts
'

Dim MyName As String
Dim MyPath As String

MyPath = "D:\Computer Classes\RobCom\RobCom Introduction to Computers\"
ChangeFileOpenDirectory MyPath

MyPath = MyPath & "*.doc"
MyName = Dir(MyPath, vbNormal) 'Get first entry
Do While MyName "" ' Start the loop.
Documents.Open FileName:=MyName, ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Copy
Windows(1).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.InsertBreak Type:=wdPageBreak
Windows(2).Activate
ActiveDocument.Close wdDoNotSaveChanges
MyName = Dir ' Get next entry.
Loop
MsgBox "Done", 48
End Sub


The first DIR command returns the first file. The second DIR at the
bottom of the loop without arguments, returns the next file that matches
the criteria. In the DO LOOP, when MyName is returned as a zero length
string, I know I'm done.


Ron

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Merge multiple files into one

I'm glad you got it sorted.

Note, however, that if INCLUDETEXT fields have been inserted in the
wrong order, you can move them in the user interface: simply press
Alt+F9 to display field codes and then use cut and paste. When you are
done, press Alt+F9 again to hide field codes.

--
Stefan Blom
Microsoft Word MVP


"Ronald Roberts" wrote in message
...
Stefan Blom wrote:
You can use Insert | File. If you want to preserve a link to the
original file, after selecting the file to insert, click the arrow
next to the Insert button and choose to "Insert as Link." This

places
an INCLUDETEXT file in the target document; to update this field

after
you've made changes to the original document(s), you can select

the
entire document and press F9.


Stefan,

Thanks for the help. The file insert works the way I want, but there
are a couple of problems. I'm using sample data of 7 documents,

Lesson
1.doc thru Lesson 7.doc. When I select all of the files using the

shift
key, Word inserts all of the documents into one new blank document.
The problem I'm having is, they are inserted in the wrong order. the
order they are inserted is Lesson 7, 1, 2, 3, 4, 5, 6. Also there

is no
page break between the documents. This works the same for Insert or
Insert Link.

What I did last night was record a macro and then add code around it

for
what I needed. Here is the code:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/25/2006 by Ronald W. Roberts
'

Dim MyName As String
Dim MyPath As String

MyPath = "D:\Computer Classes\RobCom\RobCom Introduction to

Computers\"
ChangeFileOpenDirectory MyPath

MyPath = MyPath & "*.doc"
MyName = Dir(MyPath, vbNormal) 'Get first entry
Do While MyName "" ' Start the loop.
Documents.Open FileName:=MyName, ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,

PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,

WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Copy
Windows(1).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.InsertBreak Type:=wdPageBreak
Windows(2).Activate
ActiveDocument.Close wdDoNotSaveChanges
MyName = Dir ' Get next entry.
Loop
MsgBox "Done", 48
End Sub


The first DIR command returns the first file. The second DIR at the
bottom of the loop without arguments, returns the next file that

matches
the criteria. In the DO LOOP, when MyName is returned as a zero

length
string, I know I'm done.


Ron




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th 07 10:33 PM
Insert multiple text files in microsoft word DennisM Microsoft Word Help 7 May 14th 06 04:15 PM
Saving final document to multiple files when merge document has multiple section Shannon W via OfficeKB.com Mailmerge 1 September 19th 05 05:31 AM
Combining multiple merge documents cth5c Mailmerge 1 June 15th 05 11:14 AM
Query a mail merge for multiple letters at once? Brese Mailmerge 1 May 20th 05 02:10 PM


All times are GMT +1. The time now is 10:47 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"