How to combine 755 or more word documents into one Word document with bookmarks

Hello,

It is certainly possible to add one document at a time into one master Word document using the Insert Object feature, but to do this for 755 or more documents, could take 13 to 26 hours if each document is added one at a time as the Insert Object feature allows only  one document to be inserted at a time- CANNOT SELECT SEVERAL DOCUMENTS AND ADD THEM AS SOME ONLINE POSTINGS SHOW- if you can select all of them-please tell me how, after you have tried it yourself in Word 2016.

One cannot select a bunch of them and add them into one. I TRIED THIS WITH OFFICE 365 SUPPORT AS AN ADMIN- AND MS Support VIA WEB MEETING witnessed THE PROBLEM AND DID NOT HAVE A SOLUTION.

Though, I can combine all of them into a pdf document, and then convert that master document in pdf into word. Bu then again when there are so many documents how would one check if the conversions are all good with no formatting errors et al.

Is there no way to combine a bunch of word documents into one document, other than inserting one document at a time via the insert object and then selecting same from a folder?

Wonder if Word 2016, has a way of making a Word eBook from several hundred word documents?

Thank you for your interest and consideration to share a potential solution.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

Instead of Insert > Object, put INCLUDETEXT fields in the document, one for each file to be included, each one in a separate paragraph (that is, with a paragraph mark following the field). Update all the fields (Ctrl+A to select everything, then F9 to update). Each field will show the content of the corresponding file. You can save the document as a Word file and/or a PDF file.

If all the documents to be included are stored in the same folder, a macro can create all the fields for you.

_____________________________
https://jay-freedman.info

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thank you. Very much appreciate your support.

Partial success: I took your directions, and realized yes I can select ALL the documents in the folder to insert as "Text from File".

I did that and pressed F9 to update.........but the dialog box stayed open for a long time with the circle hanging around - then after sometime I decided to click on "Insert" in the dialog box and it started to insert.

Current Problem: I have literally tried this 5 times or more but it does not take in all the documents (755) and stops always after entering each time the same amount of files.....there are about  754 selected and stops after entering about 35 files. Does word have a limit to the number of files it can insert? No error message comes up. It just stops each time at the same file and does not continue to add all despite all are selected. (very strange?!).

Waiting for a reply for a possible solution: As I was writing this I thought I could just continue adding 35 at a time.........but I will wait to hear from you or someone else to know why is this happening?

Once again thanks for all your support. Sincerely appreciate it, as I need to read all these files but cannot get to consolidate them first.

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Using an IncludeText field as Jay susggest is not the same as Insert Text from File

Jay's suggestion was to use an IncludeText Field, which while it has the same description of "Insert text from file"

Image

is not the same as what I think that you are doing which is to use Insert>Object>Text from File.

Image

As Jay suggested, if all of the files are in a folder by themselves, a macro such as the following will insert all on the required INCLUDETEXT fields, then update those fields so that each one displays the text of the assocatiated document, and optionally unlinks the fields so that the results are converted to ordinary text.

Dim FD as FileDialog

Dim strFolder as String
Dim strFile as String
Dim rng as Range

Set FD = Application.FileDialog(msoFileDialogFolderPicker)
With FD
    .Title = "Select the folder that contains the documents."
    If .Show = -1 Then
        strFolder = .SelectedItems(1) & "\"
    Else
        MsgBox "You did not select a folder."
        Exit Sub
    End If
End With
strFile = Dir$(strFolder & "*.doc")
With ActiveDocument
    While strFile <> ""
        .Range.InsertAfter vbCr
        Set rng = .Range
        rng.Collapse wdcollapsend
        .Fields.Add rng, wdFieldEmpty, "INCLUDETEXT " & Chr(34) & Replace(strFolder & strFile, "\", "/") & Chr(34)
        strFile = Dir$()
    Wend
    With .Range.Fields
        .Update
        .Unlink  'Optional to convert the result of the fields to text.
    End With
End With

Note that with 755 files to process, it may take some time for this code to process all of the files and it is very likely that Word will display Not Responding.

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Because long-running loops tend to lock up Word, I'd suggest adding the statement

DoEvents

between the line strFile = Dir$() and the line Wend.  That allows Word and Windows to process any other events that occur during each pass through the loop, and it might prevent any "Not Responding" states.

_____________________________
https://jay-freedman.info

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Doug thanks a ton for that detailed clarification!

Appreciate your care, concern and detailed clarification. Your screen capture images made me realize what I was doing wrong- yes you are right I was going into object insert text file vs. field include text file- thanks!

You guys are rock stars to help on the community.

Currently I just wanted to reply with gratitude for your efforts.

I have a deadline this Monday, after this deadline I will take this project up again and pursue to follow your guidelines.

In the interim if there are any knowledge base articles I can read to realize what macros in this case are all about would be helpful as I need to learn the basics in this case. I guess I maybe able to follow the directions you write above for the macro, but never used macros before. Sorry for being such a novice, your help is valued. I will read them after Monday so no rush to your reply.

In addition, not being greedy, since I have your attention, I wanted to find out how to create bookmarks from the consolidated documents-I just completed the pdf version of all the word documents and there are 4092 pages, so if I can be able to create bookmarks in the final word document from the consistent well formatted pages it would be a huge asset to navigate through the 4092 pages in word.

Thanks Doug and Jay !!! Appreciate your support. I will set complete on this question after I have completed this task next week.

Thank you again.

Regards.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I  did a little research on setting up a Macro to combine all the 755 documents.

But could not find any article to include the script (code?) as Jay and Doug suggested above.

I found the following support article for MS Word 2016:

https://support.office.com/en-us/article/Create-or-run-a-macro-C6B99036-905C-49A6-818A-DFB98B7C3C9C?ui=en-US&rs=en-US&ad=US#ID0EAABAAA=2016,_2013,_2010

But this article does not provide instructions on how to enter a script.

I am currently using MS Word Office 2016.

I am sorry but I need more basic instructions on how to do this.

I was able to go to the Insert- Field- IncludeText, but then I don't have an option to browse to the file to insert the text or select all......

Sorry I am lost please help.

Thank you.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

http://www.gmayor.com/installing_macro.htm has directions for installing a macro from code given in a forum post. It's nearly all copy-and-paste.
_____________________________
https://jay-freedman.info

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks Jay, appreciate your prompt response. Will attempt, and if I have any challenges will update the post. Thanks for all your support. Sincerely appreciate it.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Image

Sorry to disturb you again, got the above error, as I tried to run the Macro after saving it. Anything I should edit in the code?

Thanks!! Sincerely appreciate all the help and I am sorry for being such a novice.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Your macro code does not include the Sub ... End Sub lines

At the end of your code, before the dotted underline add a new line

End Sub

Then at the start of the macro before Dim FD As FileDialog enter two new lines

Option Explicit

Sub CombineDocs()

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Question Info


Last updated December 18, 2024 Views 2,319 Applies to: